From 53940669596987f51f1f0ef2b9dd4228b106d18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Tue, 21 Jan 2025 11:18:16 +0000 Subject: [PATCH] Merged PR 4124: Adds dedicated start date for KPIs # Description This is a extremely simple but rather important PR. It just sets the cutoff for KPIs reporting to April 2022. This affects 1) Main KPIs, 2) Guest KPIs and 3) Account Managers report Motivation behind this is to have accurate data. Early 2022 might still be shitty, but at least we have a source of truth to compare against (on revenue side, finance P&L) I set a dedicated variable because currency rates is reading from the same start date, and I intend only to modify KPIs cutoff. # Checklist - [X] The edited models and dependants run properly with production data. - [NA] The edited models are sufficiently documented. - [NA] The edited models contain PK tests, and I've ran and passed them. - [NA] I have checked for DRY opportunities with other models and docs. - [NA] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. **I need to manually run a full-refresh on daily listing segmentation that is incremental** Adds dedicated start date for KPIs Related work items: #26712 --- dbt_project.yml | 3 +++ .../kpis/int_kpis__dimension_date_product_guest.sql | 2 +- models/intermediate/kpis/int_kpis__dimension_dates.sql | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index 54a53b8..66b8d79 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -62,6 +62,9 @@ vars: # in time after which they should work. "start_date": "'2020-01-01'" + # KPIs Start Date. This is the date from which we start calculating KPIs. + "kpis_start_date": "'2022-04-01'" + # Booking state variables # States should be strings in capital letters. Models need to force an upper() "cancelled_booking_state": "'CANCELLED'" diff --git a/models/intermediate/kpis/int_kpis__dimension_date_product_guest.sql b/models/intermediate/kpis/int_kpis__dimension_date_product_guest.sql index 3036a1f..46590e7 100644 --- a/models/intermediate/kpis/int_kpis__dimension_date_product_guest.sql +++ b/models/intermediate/kpis/int_kpis__dimension_date_product_guest.sql @@ -15,4 +15,4 @@ select ud.main_billing_country_iso_3_per_deal from {{ ref("int_dates") }} as d cross join unique_dimensions as ud -where d.date_day >= {{ var("start_date") }} +where d.date_day >= {{ var("kpis_start_date") }} diff --git a/models/intermediate/kpis/int_kpis__dimension_dates.sql b/models/intermediate/kpis/int_kpis__dimension_dates.sql index 5168cf4..4bf52fb 100644 --- a/models/intermediate/kpis/int_kpis__dimension_dates.sql +++ b/models/intermediate/kpis/int_kpis__dimension_dates.sql @@ -2,7 +2,9 @@ with int_dates as ( - select * from {{ ref("int_dates") }} where date_day >= {{ var("start_date") }} + select * + from {{ ref("int_dates") }} + where date_day >= {{ var("kpis_start_date") }} ), raw_dates as ( select