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