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:
parent
995027205c
commit
3c99c4f8bc
5 changed files with 249 additions and 61 deletions
|
|
@ -2131,3 +2131,38 @@ models:
|
|||
description: |
|
||||
Achievement rate between the current year YTD and the EOFY target. It can be null
|
||||
if the target is not available.
|
||||
|
||||
- name: rel_diff_with_sign_current_month_mtd_vs_previous_month_eom
|
||||
data_type: numeric
|
||||
description: |
|
||||
Relative difference between the current month MTD and the previous month EOM,
|
||||
with a sign to represent if the relative difference is good (positive) or bad
|
||||
(negative) for our business.
|
||||
|
||||
- name: rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd
|
||||
data_type: numeric
|
||||
description: |
|
||||
Relative difference between the current month MTD and the previous year MTD,
|
||||
with a sign to represent if the relative difference is good (positive) or bad
|
||||
(negative) for our business.
|
||||
|
||||
- name: rel_diff_with_sign_current_ytd_vs_previous_ytd
|
||||
data_type: numeric
|
||||
description: |
|
||||
Relative difference between the current year YTD and the previous year YTD,
|
||||
with a sign to represent if the relative difference is good (positive) or bad
|
||||
(negative) for our business.
|
||||
|
||||
- name: rel_diff_with_sign_current_month_mtd_vs_eom_target
|
||||
data_type: numeric
|
||||
description: |
|
||||
Relative difference between the current month MTD and the EOM target,
|
||||
with a sign to represent if the relative difference is good (positive) or bad
|
||||
(negative) for our business.
|
||||
|
||||
- name: rel_diff_with_sign_current_ytd_vs_ytd_target
|
||||
data_type: numeric
|
||||
description: |
|
||||
Relative difference between the current year YTD and the YTD target,
|
||||
with a sign to represent if the relative difference is good (positive) or bad
|
||||
(negative) for our business.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ with
|
|||
select * from {{ ref("int_ytd_mtd_aggregated_main_metrics_overview") }}
|
||||
),
|
||||
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
|
||||
select
|
||||
dimension, financial_year, id_metric, max(m.date) as latest_available_date
|
||||
from int_ytd_mtd_aggregated_main_metrics_overview m
|
||||
where
|
||||
(
|
||||
(
|
||||
|
|
@ -12,20 +13,17 @@ 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
|
||||
)
|
||||
|
|
@ -65,7 +63,17 @@ select
|
|||
m.target_eofy_value as target_eofy_value,
|
||||
m.diff_current_ytd_vs_eofy_target as diff_current_ytd_vs_eofy_target,
|
||||
m.achievement_rate_current_ytd_vs_eofy_target
|
||||
as achievement_rate_current_ytd_vs_eofy_target
|
||||
as achievement_rate_current_ytd_vs_eofy_target,
|
||||
m.rel_diff_with_sign_current_month_mtd_vs_previous_month_eom
|
||||
as rel_diff_with_sign_current_month_mtd_vs_previous_month_eom,
|
||||
m.rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd
|
||||
as rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd,
|
||||
m.rel_diff_with_sign_current_ytd_vs_previous_ytd
|
||||
as rel_diff_with_sign_current_ytd_vs_previous_ytd,
|
||||
m.rel_diff_with_sign_current_month_mtd_vs_eom_target
|
||||
as rel_diff_with_sign_current_month_mtd_vs_eom_target,
|
||||
m.rel_diff_with_sign_current_ytd_vs_ytd_target
|
||||
as rel_diff_with_sign_current_ytd_vs_ytd_target
|
||||
from int_ytd_mtd_aggregated_main_metrics_overview m
|
||||
inner join
|
||||
latest_dates_per_financial_year ld
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue