Merged PR 4087: Added expected_mrr

# Description

Added new expected_mrr metric to Main KPIs mtd model

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

Related work items: #26223
This commit is contained in:
Joaquin Ossa 2025-01-17 08:47:14 +00:00
commit e28ea25e47
3 changed files with 51 additions and 2 deletions

View file

@ -278,6 +278,15 @@
"number_format": "currency_gbp",
"increment_sign_format": "positive",
},
{
"order_by": 203,
"metric": "Expected MRR",
"value": "expected_mrr",
"previous_year_value": "previous_year_expected_mrr",
"relative_increment": "relative_increment_expected_mrr",
"number_format": "currency_gbp",
"increment_sign_format": "positive",
},
{
"order_by": 211,
"metric": "Total Revenue per Booking Created",

View file

@ -171,6 +171,33 @@ with
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET'
),
int_monthly_onboarding_mrr_metrics as (
select
date,
'by_number_of_listings' as dimension,
hubspot_listing_segmentation as dimension_value,
expected_mrr
from {{ ref("int_monthly_onboarding_mrr_metrics") }}
where
main_billing_country_iso_3 = 'global'
and hubspot_listing_segmentation <> 'global'
union all
select
date,
'by_billing_country' as dimension,
main_billing_country_iso_3 as dimension_value,
expected_mrr
from {{ ref("int_monthly_onboarding_mrr_metrics") }}
where
hubspot_listing_segmentation = 'global'
and main_billing_country_iso_3 <> 'global'
union all
select date, 'global' as dimension, 'global' as dimension_value, expected_mrr
from {{ ref("int_monthly_onboarding_mrr_metrics") }}
where
hubspot_listing_segmentation = 'global'
and main_billing_country_iso_3 = 'global'
),
plain_kpi_combination as (
@ -330,7 +357,10 @@ with
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0)
+ coalesce(host_resolutions.xero_host_resolution_amount_paid_in_gbp, 0),
0
) as revenue_retained_post_resolutions_in_gbp
) as revenue_retained_post_resolutions_in_gbp,
-- ONBOARDING MRR METRIC --
onboarding_mrr.expected_mrr as expected_mrr
from int_kpis__agg_dates_main_kpis d
left join
@ -403,6 +433,11 @@ with
on d.date = churn.date
and d.dimension = churn.dimension
and d.dimension_value = churn.dimension_value
left join
int_monthly_onboarding_mrr_metrics onboarding_mrr
on d.date = onboarding_mrr.date
and d.dimension = onboarding_mrr.dimension
and d.dimension_value = onboarding_mrr.dimension_value
)
select
current.year,
@ -518,7 +553,10 @@ select
{{ calculate_safe_relative_increment("revenue_retained_in_gbp") }},
-- INCOME RETAINED POST RESOLUTIONS--
{{ calculate_safe_relative_increment("revenue_retained_post_resolutions_in_gbp") }}
{{ calculate_safe_relative_increment("revenue_retained_post_resolutions_in_gbp") }},
-- ONBOARDING MRR METRIC --
{{ calculate_safe_relative_increment("expected_mrr") }}
from plain_kpi_combination current
left join

View file

@ -68,6 +68,7 @@ where
or lower(metric) like '%resolutions%'
or lower(metric) like '%invoiced%'
or lower(metric) like '%retained%'
or lower(metric) like '%expected mrr%'
or lower(metric) like '%damage host%'
)
and {{ is_date_before_previous_month("date") }}
@ -79,6 +80,7 @@ where
or lower(metric) like '%resolutions%'
or lower(metric) like '%invoiced%'
or lower(metric) like '%retained%'
or lower(metric) like '%expected mrr%'
or lower(metric) like '%damage host%'
)
)