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`.
This commit is contained in:
Oriol Roqué Paniagua 2025-02-25 11:43:46 +00:00
parent 5eebb4f560
commit 7c4b0e752b
3 changed files with 33 additions and 37 deletions

View file

@ -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,

View file

@ -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

View file

@ -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
)