MRR change

This commit is contained in:
Joaquin Ossa 2025-01-30 15:15:34 +01:00
parent a208541e04
commit 142b5a526f
3 changed files with 13 additions and 6 deletions

View file

@ -20,7 +20,7 @@ with
) )
-- Calculate expected MRR per deal by each dimension -- Calculate expected MRR per deal by each dimension
select select
m.date, (date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
'by_number_of_listings' as dimension, 'by_number_of_listings' as dimension,
d.hubspot_listing_segmentation as dimension_value, d.hubspot_listing_segmentation as dimension_value,
sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal
@ -36,7 +36,7 @@ where d.hubspot_listing_segmentation <> 'UNSET'
group by 1, 2, 3 group by 1, 2, 3
union all union all
select select
m.date, (date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
'by_billing_country' as dimension, 'by_billing_country' as dimension,
d.main_billing_country_iso_3_per_deal as dimension_value, d.main_billing_country_iso_3_per_deal as dimension_value,
sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal
@ -52,7 +52,7 @@ where d.hubspot_listing_segmentation <> 'UNSET'
group by 1, 2, 3 group by 1, 2, 3
union all union all
select select
m.date, (date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
'global' as dimension, 'global' as dimension,
'global' as dimension_value, 'global' as dimension_value,
sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal

View file

@ -1712,8 +1712,8 @@ models:
"This table provides data on the Onboarding Monthly Recurring Revenue (MRR). "This table provides data on the Onboarding Monthly Recurring Revenue (MRR).
The Onboarding MRR is an estimate of the expected monthly revenue generated by The Onboarding MRR is an estimate of the expected monthly revenue generated by
each new deal. It is calculated by taking the total revenue generated by all each new deal. It is calculated by taking the total revenue generated by all
active accounts over the last 12 months and dividing it by the number of active active accounts over the last 12 previous months and dividing it by the number
months for each account." of active months for each account."
data_tests: data_tests:
- dbt_utils.unique_combination_of_columns: - dbt_utils.unique_combination_of_columns:

View file

@ -68,11 +68,18 @@ where
or lower(metric) like '%resolutions%' or lower(metric) like '%resolutions%'
or lower(metric) like '%invoiced%' or lower(metric) like '%invoiced%'
or lower(metric) like '%retained%' or lower(metric) like '%retained%'
or lower(metric) like '%mrr%'
or lower(metric) like '%damage host%' or lower(metric) like '%damage host%'
) )
and {{ is_date_before_previous_month("date") }} and {{ is_date_before_previous_month("date") }}
) )
-- Not show current month if the metric is Expected MRR, unlike other
-- revenue metrics, Expected MRR is calculated for the next month, so it is not
-- affected by the invoicing cycle.
or not
(
lower(metric) like '%mrr%'
and date_trunc('month', m.date)::date = date_trunc('month', now())::date
)
-- Keep all history for the rest of metrics -- Keep all history for the rest of metrics
or not or not
( (