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

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