From 7c4b0e752b1105f0fa61ba4a20683e0ba818acec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Tue, 25 Feb 2025 11:43:46 +0000 Subject: [PATCH] Merged PR 4501: Revert "Refactor display exclusion for clarity purposes" # Description _Describe your motivation and changes here._ # Checklist - [ ] The edited models and dependants run properly with production data. - [ ] The edited models are sufficiently documented. - [ ] The edited models contain PK tests, and I've ran and passed them. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Revert "Refactor display exclusion for clarity purposes" Reverted commit `fdec616f`. --- ...d_mtd_aggregated_main_metrics_overview.sql | 36 +++++++++---------- models/intermediate/cross/schema.yml | 12 ++----- ...d_mtd_aggregated_main_metrics_overview.sql | 22 ++++++------ 3 files changed, 33 insertions(+), 37 deletions(-) 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 18ba40b..280d074 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 @@ -7,7 +7,7 @@ "previous_year_MTD": "previous_year_mtd_total_revenue_in_gbp", "current_YTD": "current_ytd_total_revenue_in_gbp", "previous_YTD": "previous_ytd_total_revenue_in_gbp", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 2, @@ -17,7 +17,7 @@ "previous_year_MTD": "previous_year_mtd_revenue_retained_post_resolutions_in_gbp", "current_YTD": "current_ytd_revenue_retained_post_resolutions_in_gbp", "previous_YTD": "previous_ytd_revenue_retained_post_resolutions_in_gbp", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 3, @@ -27,7 +27,7 @@ "previous_year_MTD": "previous_year_mtd_total_guest_payments_in_gbp", "current_YTD": "current_ytd_total_guest_payments_in_gbp", "previous_YTD": "previous_ytd_total_guest_payments_in_gbp", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 4, @@ -37,7 +37,7 @@ "previous_year_MTD": "previous_year_mtd_xero_operator_net_fees_in_gbp", "current_YTD": "current_ytd_xero_operator_net_fees_in_gbp", "previous_YTD": "previous_ytd_xero_operator_net_fees_in_gbp", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 5, @@ -47,7 +47,7 @@ "previous_year_MTD": "previous_year_mtd_xero_apis_net_fees_in_gbp", "current_YTD": "current_ytd_xero_apis_net_fees_in_gbp", "previous_YTD": "previous_ytd_xero_apis_net_fees_in_gbp", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 6, @@ -57,7 +57,7 @@ "previous_year_MTD": "previous_year_mtd_billable_bookings", "current_YTD": "current_ytd_billable_bookings", "previous_YTD": "previous_ytd_billable_bookings", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 7, @@ -67,7 +67,7 @@ "previous_year_MTD": "previous_year_mtd_live_deals", "current_YTD": "current_ytd_live_deals", "previous_YTD": "previous_ytd_live_deals", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 8, @@ -77,7 +77,7 @@ "previous_year_MTD": "previous_year_mtd_new_deals", "current_YTD": "current_ytd_new_deals", "previous_YTD": "previous_ytd_new_deals", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 9, @@ -87,7 +87,7 @@ "previous_year_MTD": "previous_year_mtd_churning_deals", "current_YTD": "current_ytd_churning_deals", "previous_YTD": "previous_ytd_churning_deals", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 10, @@ -97,7 +97,7 @@ "previous_year_MTD": "previous_year_mtd_waiver_payout_rate", "current_YTD": "current_ytd_waiver_payout_rate", "previous_YTD": "previous_ytd_waiver_payout_rate", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 11, @@ -107,7 +107,7 @@ "previous_year_MTD": "previous_year_mtd_resolutions_payout_rate", "current_YTD": "current_ytd_resolutions_payout_rate", "previous_YTD": "previous_ytd_resolutions_payout_rate", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 12, @@ -117,7 +117,7 @@ "previous_year_MTD": "previous_year_mtd_operator_revenue_per_billable_booking", "current_YTD": "current_ytd_operator_revenue_per_billable_booking", "previous_YTD": "previous_ytd_operator_revenue_per_billable_booking", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 13, @@ -127,7 +127,7 @@ "previous_year_MTD": "previous_year_mtd_waiver_revenue_per_billable_booking", "current_YTD": "current_ytd_waiver_revenue_per_billable_booking", "previous_YTD": "previous_ytd_waiver_revenue_per_billable_booking", - "display_exclusion": "NONE", + "requires_invoicing_data": false, }, { "id_metric": 14, @@ -137,7 +137,7 @@ "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", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 15, @@ -147,7 +147,7 @@ "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", - "display_exclusion": "INVOICING", + "requires_invoicing_data": true, }, { "id_metric": 16, @@ -157,7 +157,7 @@ "previous_year_MTD": "previous_year_mtd_total_revenue_churn_rate", "current_YTD": "current_ytd_total_revenue_churn_rate", "previous_YTD": "previous_ytd_total_revenue_churn_rate", - "display_exclusion": "ONGOING_MONTH", + "requires_invoicing_data": false, }, { "id_metric": 17, @@ -167,7 +167,7 @@ "previous_year_MTD": "previous_year_mtd_onboarding_mrr", "current_YTD": "current_ytd_onboarding_mrr", "previous_YTD": "previous_ytd_onboarding_mrr", - "display_exclusion": "ONGOING_MONTH", + "requires_invoicing_data": false, }, ] %} with @@ -189,7 +189,7 @@ with {{ metric.id_metric }} as id_metric, -- quotation marks added because text format '{{ metric.name }}' as metric_name, - '{{ metric.display_exclusion }}' as display_exclusion, + {{ metric.requires_invoicing_data }} as requires_invoicing_data, {{ metric.current_month_MTD }} as current_month_mtd, {{ metric.previous_month_EOM }} as previous_month_eom, {{ metric.previous_year_MTD }} as previous_year_mtd, diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index 1fa70b8..9ab27c8 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -2538,19 +2538,13 @@ models: data_tests: - not_null - - name: display_exclusion - data_type: string + - name: requires_invoicing_data + data_type: boolean description: | - Category to indicate if the metric requires a certain exclusion due - to relying on not timely information. + Flag to indicate if the metric requires invoicing data to be calculated. This will limit the display for reporting purposes. data_tests: - not_null - - accepted_values: - values: - - NONE - - INVOICING - - ONGOING_MONTH - name: current_month_mtd data_type: numeric 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 c2a4a91..d363a83 100644 --- a/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql +++ b/models/reporting/general/ytd_mtd_aggregated_main_metrics_overview.sql @@ -4,7 +4,7 @@ with ), latest_dates_per_financial_year as ( select dimension, financial_year, id_metric, max(date) as latest_available_date - from int_ytd_mtd_aggregated_main_metrics_overview m + from int_ytd_mtd_aggregated_main_metrics_overview where ( ( @@ -12,18 +12,20 @@ with -- invoicing cycle and it is before the 20th of the month, if it -- is the 20th of the month or after, only exclude the current -- month. - display_exclusion = 'INVOICING' + requires_invoicing_data = true and {{ is_date_before_20th_of_previous_month("date") }} ) - or ( - -- Handle exclusion for Churn/MRR metrics: do not show them in the - -- current - -- month. - display_exclusion = 'ONGOING_MONTH' - and date_trunc('month', m.date) > date_trunc('month', current_date) - ) -- Keep all history for the rest of metrics - or display_exclusion = 'NONE' + or requires_invoicing_data = false + ) + -- Handle exclusion for Churn/MRR metrics: do not show them in the current + -- month. + and not ( + ( + lower(metric_name) like '%revenue%churn%rate%' + or lower(metric_name) like '%onboarding%mrr%' + ) + and date_trunc('month', "date") = date_trunc('month', current_date) ) group by dimension, financial_year, id_metric )