From 5ddbe5d5aff621bf1a83a0be9708d3e206078fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Wed, 5 Mar 2025 14:31:36 +0000 Subject: [PATCH] Merged PR 4616: Adds first day month for reporting purposes # Description Just adds the first day of the month for AM models. The problem is that the display of the graph and the value shown are misleading. This aims to fix it. I hate PBI. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Adds first day month for reporting purposes Related work items: #28181 --- ...ated_metrics_history_by_deal_by_time_window.sql | 1 + .../general/monthly_growth_score_by_deal.sql | 2 +- models/reporting/general/schema.yml | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/models/reporting/general/monthly_aggregated_metrics_history_by_deal_by_time_window.sql b/models/reporting/general/monthly_aggregated_metrics_history_by_deal_by_time_window.sql index 253280e..cf38baa 100644 --- a/models/reporting/general/monthly_aggregated_metrics_history_by_deal_by_time_window.sql +++ b/models/reporting/general/monthly_aggregated_metrics_history_by_deal_by_time_window.sql @@ -6,6 +6,7 @@ with select date as date, + date_trunc('month', date)::date as first_day_month, id_deal as id_deal, time_window as time_window, metric_from_date as metric_from_date, diff --git a/models/reporting/general/monthly_growth_score_by_deal.sql b/models/reporting/general/monthly_growth_score_by_deal.sql index 73dc0bb..d354319 100644 --- a/models/reporting/general/monthly_growth_score_by_deal.sql +++ b/models/reporting/general/monthly_growth_score_by_deal.sql @@ -4,8 +4,8 @@ with ) select date as date, + date_trunc('month', date)::date as first_day_month, id_deal as id_deal, - client_type as client_type, main_deal_name as main_deal_name, has_active_pms as has_active_pms, diff --git a/models/reporting/general/schema.yml b/models/reporting/general/schema.yml index 9836f22..10983fc 100644 --- a/models/reporting/general/schema.yml +++ b/models/reporting/general/schema.yml @@ -641,6 +641,13 @@ models: data_tests: - not_null + - name: first_day_month + data_type: date + description: | + First day of the month corresponding to the date field. + data_tests: + - not_null + - name: client_type data_type: string description: | @@ -1479,6 +1486,13 @@ models: data_tests: - not_null + - name: first_day_month + data_type: date + description: | + First day of the month corresponding to the date field. + data_tests: + - not_null + - name: id_deal data_type: character varying description: Id of the deal associated to the host.