Merged PR 4504: Onboarding MRR + Visualisation changes

# Description

Changes:
* Adds Onboarding MRR
* Refactors exclusion code for ongoing month / invoicing cycle
* Adds sign format on relative differences

# 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.

Related work items: #27609, #27805
This commit is contained in:
Oriol Roqué Paniagua 2025-02-25 14:05:54 +00:00
parent 995027205c
commit 3c99c4f8bc
5 changed files with 249 additions and 61 deletions

View file

@ -40,6 +40,7 @@ with
as current_month_mtd_total_revenue_churn_12m,
total_revenue_global_preceding_12_months
as current_month_mtd_total_revenue_global_12m,
expected_mrr as current_month_mtd_onboarding_mrr,
-- Previous Year (12 months ago), Month To Date Metrics --
previous_year_total_revenue_in_gbp
@ -66,6 +67,7 @@ with
as previous_year_mtd_total_revenue_churn_12m,
previous_year_total_revenue_global_preceding_12_months
as previous_year_mtd_total_revenue_global_12m,
previous_year_expected_mrr as previous_year_mtd_onboarding_mrr,
-- Previous Month, End Of Month Metrics --
lag(total_revenue_in_gbp) over (
@ -109,7 +111,10 @@ with
) as previous_month_eom_total_revenue_churn_12m,
lag(total_revenue_global_preceding_12_months) over (
partition by dimension, dimension_value order by date
) as previous_month_eom_total_revenue_global_12m
) as previous_month_eom_total_revenue_global_12m,
lag(expected_mrr) over (
partition by dimension, dimension_value order by date
) as previous_month_eom_onboarding_mrr
from int_mtd_vs_previous_year_metrics
where
@ -188,6 +193,11 @@ with
order by date
rows between unbounded preceding and current row
) as current_ytd_total_revenue_global_12m,
sum(current_month_mtd_onboarding_mrr) over (
partition by financial_year, dimension, dimension_value
order by date
rows between unbounded preceding and current row
) as current_ytd_onboarding_mrr,
-- Specific treatment for live_deals as it is a counter
current_month_mtd_live_deals as current_ytd_live_deals,
@ -257,6 +267,11 @@ with
order by date
rows between unbounded preceding and current row
) as previous_ytd_total_revenue_global_12m,
sum(previous_year_mtd_onboarding_mrr) over (
partition by financial_year, dimension, dimension_value
order by date
rows between unbounded preceding and current row
) as previous_ytd_onboarding_mrr,
-- Specific treatment for live_deals as it is a counter
previous_year_mtd_live_deals as previous_ytd_live_deals