diff --git a/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql b/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql deleted file mode 100644 index f1c5170..0000000 --- a/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql +++ /dev/null @@ -1,72 +0,0 @@ -with - int_monthly_aggregated_metrics_history_by_deal as ( - 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 ( - select - id_deal, - coalesce( - main_billing_country_iso_3_per_deal, 'UNSET' - ) as main_billing_country_iso_3_per_deal, - effective_deal_start_month, - hubspot_deal_cancellation_month, - coalesce( - hubspot_listing_segmentation, 'UNSET' - ) as hubspot_listing_segmentation - from int_kpis__dimension_deals - -- Exclude deals without live dates - where effective_deal_start_date_utc is not null - ) --- Calculate expected MRR per deal by each dimension -select - 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 -from int_monthly_aggregated_metrics_history_by_deal m -inner join - deal_attributes d - on m.id_deal = d.id_deal - and date_trunc('month', m.date) >= date_trunc('month', d.effective_deal_start_month) - and date_trunc('month', m.date) - <= coalesce(d.hubspot_deal_cancellation_month, '2099-01-01') - and date_trunc('month', m.date)::date <> date_trunc('month', now())::date -where d.hubspot_listing_segmentation <> 'UNSET' -group by 1, 2, 3 -union all -select - 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 -from int_monthly_aggregated_metrics_history_by_deal m -inner join - deal_attributes d - on m.id_deal = d.id_deal - and date_trunc('month', m.date) >= date_trunc('month', d.effective_deal_start_month) - and date_trunc('month', m.date) - <= coalesce(d.hubspot_deal_cancellation_month, '2099-01-01') - and date_trunc('month', m.date)::date <> date_trunc('month', now())::date -where d.hubspot_listing_segmentation <> 'UNSET' -group by 1, 2, 3 -union all -select - 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 -from int_monthly_aggregated_metrics_history_by_deal m -inner join - deal_attributes d - on m.id_deal = d.id_deal - and date_trunc('month', m.date) >= date_trunc('month', d.effective_deal_start_month) - and date_trunc('month', m.date) - <= coalesce(d.hubspot_deal_cancellation_month, '2099-01-01') - and date_trunc('month', m.date)::date <> date_trunc('month', now())::date -where d.hubspot_listing_segmentation <> 'UNSET' -group by 1, 2, 3 diff --git a/models/intermediate/cross/int_mtd_agg_onboarding_mrr_revenue.sql b/models/intermediate/cross/int_mtd_agg_onboarding_mrr_revenue.sql deleted file mode 100644 index f57c266..0000000 --- a/models/intermediate/cross/int_mtd_agg_onboarding_mrr_revenue.sql +++ /dev/null @@ -1,31 +0,0 @@ -with - int_kpis__agg_daily_deals as ( - select date, dimension_value as hubspot_listing_segmentation, new_deals - from {{ ref("int_kpis__agg_daily_deals") }} - where dimension = 'by_number_of_listings' - ), - number_of_listing_expected_mrr as ( - select - mom.date, - mom.dimension, - mom.dimension_value, - ad.new_deals as number_of_new_deals, - mom.expected_mrr_per_deal * ad.new_deals as expected_mrr - from {{ ref("int_monthly_onboarding_mrr_per_deal") }} mom - left join - int_kpis__agg_daily_deals ad - on mom.date = ad.date - and mom.dimension_value = ad.hubspot_listing_segmentation - where mom.dimension = 'by_number_of_listings' - ) -select * -from number_of_listing_expected_mrr -union all -select - date, - 'global' as dimension, - 'global' as dimension_value, - sum(number_of_new_deals) as number_of_new_deals, - sum(expected_mrr) as expected_mrr -from number_of_listing_expected_mrr -group by date diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index 27f9fe4..f57330d 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -1694,106 +1694,6 @@ models: data_type: boolean description: "Flag to indicate if the deal is in Xero." - - name: int_monthly_onboarding_mrr_per_deal - deprecation_date: 2025-04-09 - description: | - "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 (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: - combination_of_columns: - - date - - dimension - - dimension_value - - columns: - - name: date - data_type: date - description: The date for the month-to-date metrics. - data_tests: - - not_null - - - name: dimension - data_type: string - description: The dimension or granularity of the metrics. - data_tests: - - accepted_values: - values: - - global - - by_number_of_listings - - by_billing_country - - - name: dimension_value - data_type: string - description: The value or segment available for the selected dimension. - data_tests: - - not_null - - - name: expected_mrr_per_deal - data_type: numeric - description: | - "Expected MRR for each new deal." - data_tests: - - not_null - - - name: int_mtd_agg_onboarding_mrr_revenue - deprecation_date: 2025-04-09 - description: | - This model contains the month-to-date aggregated metrics for onboarding MRR. - It includes the total expected MRR revenue for the month, aggregated by - dimension for 'global' and 'by_number_of_listings' only. - - The 'by_number_of_listings' dimension is calculated by multiplying the - expected MRR per deal by the number of new deals in that segment. - - The 'global' dimension represents the sum of all expected MRRs across - all segments. - - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - date - - dimension - - dimension_value - - columns: - - name: date - data_type: date - description: The date for the month-to-date metrics. - data_tests: - - not_null - - - name: dimension - data_type: string - description: The dimension or granularity of the metrics. - data_tests: - - accepted_values: - values: - - global - - by_number_of_listings - - - name: dimension_value - data_type: string - description: The value or segment available for the selected dimension. - data_tests: - - not_null - - - name: number_of_new_deals - data_type: numeric - description: Number of new deals in the month. - - - name: expected_mrr - data_type: numeric - description: | - Total expected Onboarding MRR. - This is calculated by multiplying the expected MRR per deal by the number of new deals. - For the "global" dimension, it is the sum of all expected MRRs across segments. - - name: int_ytd_mtd_main_metrics_overview description: | This model provides a high-level overview of the main metrics for the month-to-date