From 8cf7393173ca60e4d1ed4bbfe69eb8fe6c290577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Thu, 20 Feb 2025 18:43:26 +0000 Subject: [PATCH] Merged PR 4471: Visualisation changes # Description Adapts YTD/MTD for visualisation purposes # 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. Visualisation changes Related work items: #27609 --- ...d_mtd_aggregated_main_metrics_overview.sql | 20 +++++++++++++++++++ models/reporting/general/schema.yml | 6 ++++++ ...d_mtd_aggregated_main_metrics_overview.sql | 1 + 3 files changed, 27 insertions(+) diff --git a/models/intermediate/cross/int_ytd_mtd_aggregated_main_metrics_overview.sql b/models/intermediate/cross/int_ytd_mtd_aggregated_main_metrics_overview.sql index ec8b6f2..fbed7b9 100644 --- a/models/intermediate/cross/int_ytd_mtd_aggregated_main_metrics_overview.sql +++ b/models/intermediate/cross/int_ytd_mtd_aggregated_main_metrics_overview.sql @@ -129,6 +129,26 @@ "previous_YTD": "previous_ytd_waiver_revenue_per_billable_booking", "requires_invoicing_data": false, }, + { + "id_metric": 14, + "name": "Damage Host-Waiver Payments", + "current_month_MTD": "-1*current_month_mtd_xero_waiver_paid_back_to_host_in_gbp", + "previous_month_EOM": "-1*previous_month_eom_xero_waiver_paid_back_to_host_in_gbp", + "previous_year_MTD": "-1*previous_year_mtd_xero_waiver_paid_back_to_host_in_gbp", + "current_YTD": "-1*current_ytd_xero_waiver_paid_back_to_host_in_gbp", + "previous_YTD": "-1*previous_ytd_xero_waiver_paid_back_to_host_in_gbp", + "requires_invoicing_data": true, + }, + { + "id_metric": 15, + "name": "Host Resolutions Amount Paid", + "current_month_MTD": "-1*current_month_mtd_xero_host_resolution_amount_paid_in_gbp", + "previous_month_EOM": "-1*previous_month_eom_xero_host_resolution_amount_paid_in_gbp", + "previous_year_MTD": "-1*previous_year_mtd_xero_host_resolution_amount_paid_in_gbp", + "current_YTD": "-1*current_ytd_xero_host_resolution_amount_paid_in_gbp", + "previous_YTD": "-1*previous_ytd_xero_host_resolution_amount_paid_in_gbp", + "requires_invoicing_data": true, + }, ] %} with int_ytd_mtd_main_metrics_overview as ( diff --git a/models/reporting/general/schema.yml b/models/reporting/general/schema.yml index 6e3584d..8b38566 100644 --- a/models/reporting/general/schema.yml +++ b/models/reporting/general/schema.yml @@ -1968,6 +1968,12 @@ models: data_tests: - not_null + - name: first_day_month + data_type: date + description: The first day of the month associated with the data. + data_tests: + - not_null + - name: calendar_year data_type: integer description: The calendar year associated with the data. diff --git a/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql b/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql index 878ce7e..903d665 100644 --- a/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql +++ b/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql @@ -25,6 +25,7 @@ select m.calendar_year as calendar_year, m.financial_year as financial_year, m.date as date, + date_trunc('month', m.date)::date as first_day_month, case when m.date = ld.latest_available_date then 1 else 0 end as is_latest_date, m.previous_year_date as previous_year_date, m.dimension as dimension,