Removed changes for cutoff date

This commit is contained in:
Joaquin Ossa 2025-01-30 16:18:29 +01:00
parent 396d19b549
commit bb9dea8ed6
4 changed files with 14 additions and 37 deletions

View file

@ -1,6 +1,10 @@
with
int_monthly_aggregated_metrics_history_by_deal as (
select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }}
select
*,
(date_trunc('month', date) + interval '2 month' - interval '1 day')::date
as next_month_end_date
from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }}
),
int_kpis__dimension_deals as (select * from {{ ref("int_kpis__dimension_deals") }}),
deal_attributes as (
@ -20,7 +24,7 @@ with
)
-- Calculate expected MRR per deal by each dimension
select
(date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
m.next_month_end_date as date,
'by_number_of_listings' as dimension,
d.hubspot_listing_segmentation as dimension_value,
sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal
@ -36,7 +40,7 @@ where d.hubspot_listing_segmentation <> 'UNSET'
group by 1, 2, 3
union all
select
(date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
m.next_month_end_date as date,
'by_billing_country' as dimension,
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
@ -52,7 +56,7 @@ where d.hubspot_listing_segmentation <> 'UNSET'
group by 1, 2, 3
union all
select
(date_trunc('month', m.date) + interval '2 month' - interval '1 day')::date as date,
m.next_month_end_date as date,
'global' as dimension,
'global' as dimension_value,
sum(coalesce(m.total_revenue_in_gbp, 0)) / count(*) as expected_mrr_per_deal

View file

@ -1712,8 +1712,11 @@ models:
"This table provides data on the Onboarding Monthly Recurring Revenue (MRR).
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
active accounts over the last 12 previous months and dividing it by the number
of active months for each account."
active accounts over the last 12 previous months (before the ongoing month)
and dividing it by the number of active months for each account during this
period.
For example in December 2023 we will calculate the Onboarding MRR for a deal
using the revenue from December 2022 to November 2023."
data_tests:
- dbt_utils.unique_combination_of_columns:

View file

@ -70,7 +70,7 @@ where
or lower(metric) like '%retained%'
or lower(metric) like '%damage host%'
)
and {{ is_date_before_previous_month_fixed_20("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