From b1b527f47df6820677af5daca887bdd4fa56fe41 Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Sun, 17 Nov 2024 17:40:00 +0100 Subject: [PATCH] restricted to 1 year in the future --- .../kpis/int_kpis__product_guest_daily_metrics.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/models/intermediate/kpis/int_kpis__product_guest_daily_metrics.sql b/models/intermediate/kpis/int_kpis__product_guest_daily_metrics.sql index 153d047..5a8a8df 100644 --- a/models/intermediate/kpis/int_kpis__product_guest_daily_metrics.sql +++ b/models/intermediate/kpis/int_kpis__product_guest_daily_metrics.sql @@ -29,7 +29,6 @@ with from {{ ref("int_kpis__metric_daily_check_in_attributed_guest_journeys") }} gj group by gj.date, gj.has_payment, gj.has_id_check ), - max_guest_date as (select max(date) as max_date from guest_journey_metrics), guest_payment_metrics as ( select gp.date, @@ -70,8 +69,8 @@ with on gp.date = dd.date_day and gp.has_id_check = dd.has_id_check and dd.has_payment = {{ has_payment_true }} - cross join max_guest_date m - where dd.date_day <= m.max_date + -- Restricts the records to only those in the past to 1 year in the future + where dd.date_day <= current_date + interval '1 year' ) select