From 40c8e20e70108a378fb7a7e1c88c26952edc7960 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Thu, 30 Jan 2025 16:30:03 +0100 Subject: [PATCH] Addressed comments --- .../cross/int_monthly_onboarding_mrr_per_deal.sql | 4 ++-- .../reporting/general/mtd_aggregated_metrics.sql | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql b/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql index be29b55..f1c5170 100644 --- a/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql +++ b/models/intermediate/cross/int_monthly_onboarding_mrr_per_deal.sql @@ -1,9 +1,9 @@ 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 + 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") }}), diff --git a/models/reporting/general/mtd_aggregated_metrics.sql b/models/reporting/general/mtd_aggregated_metrics.sql index 427fb15..e5509c4 100644 --- a/models/reporting/general/mtd_aggregated_metrics.sql +++ b/models/reporting/general/mtd_aggregated_metrics.sql @@ -72,14 +72,6 @@ where ) 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', date)::date = date_trunc('month', now())::date - ) -- Keep all history for the rest of metrics or not ( @@ -91,5 +83,8 @@ where or lower(metric) like '%damage host%' ) ) - -- If metric is Churn Rate, do not show month in progress - and not (lower(metric) like '%churn rate%' and is_current_month = true) + -- If metric is Churn Rate or Expected MRR, do not show month in progress + and not ( + (lower(metric) like '%churn rate%' or lower(metric) like '%mrr%') + and is_current_month = true + )