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 280d074..18ba40b 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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "NONE", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": true, + "display_exclusion": "INVOICING", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "ONGOING_MONTH", }, { "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", - "requires_invoicing_data": false, + "display_exclusion": "ONGOING_MONTH", }, ] %} with @@ -189,7 +189,7 @@ with {{ metric.id_metric }} as id_metric, -- quotation marks added because text format '{{ metric.name }}' as metric_name, - {{ metric.requires_invoicing_data }} as requires_invoicing_data, + '{{ metric.display_exclusion }}' as display_exclusion, {{ 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 9ab27c8..1fa70b8 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -2538,13 +2538,19 @@ models: data_tests: - not_null - - name: requires_invoicing_data - data_type: boolean + - name: display_exclusion + data_type: string description: | - Flag to indicate if the metric requires invoicing data to be calculated. + Category to indicate if the metric requires a certain exclusion due + to relying on not timely information. 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 d363a83..c2a4a91 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 + from int_ytd_mtd_aggregated_main_metrics_overview m where ( ( @@ -12,20 +12,18 @@ 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. - requires_invoicing_data = true + display_exclusion = 'INVOICING' and {{ is_date_before_20th_of_previous_month("date") }} ) - -- Keep all history for the rest of metrics - 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%' + 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) ) - and date_trunc('month', "date") = date_trunc('month', current_date) + -- Keep all history for the rest of metrics + or display_exclusion = 'NONE' ) group by dimension, financial_year, id_metric )