Addressed comments

This commit is contained in:
Joaquin Ossa 2025-01-30 16:30:03 +01:00
parent bb9dea8ed6
commit 40c8e20e70
2 changed files with 7 additions and 12 deletions

View file

@ -1,9 +1,9 @@
with with
int_monthly_aggregated_metrics_history_by_deal as ( int_monthly_aggregated_metrics_history_by_deal as (
select select
*,
(date_trunc('month', date) + interval '2 month' - interval '1 day')::date (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") }} from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }}
), ),
int_kpis__dimension_deals as (select * from {{ ref("int_kpis__dimension_deals") }}), int_kpis__dimension_deals as (select * from {{ ref("int_kpis__dimension_deals") }}),

View file

@ -72,14 +72,6 @@ where
) )
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', 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
( (
@ -91,5 +83,8 @@ where
or lower(metric) like '%damage host%' or lower(metric) like '%damage host%'
) )
) )
-- If metric is Churn Rate, do not show month in progress -- If metric is Churn Rate or Expected MRR, do not show month in progress
and not (lower(metric) like '%churn rate%' and is_current_month = true) and not (
(lower(metric) like '%churn rate%' or lower(metric) like '%mrr%')
and is_current_month = true
)