Added boolean

This commit is contained in:
Joaquin 2025-03-28 09:02:12 +01:00
parent 3833f3e92d
commit b138e0c626
2 changed files with 5 additions and 2 deletions

View file

@ -14,7 +14,7 @@ with
select *
from {{ ref("int_kpis__lifecycle_daily_deal") }}
-- Only retrieve deals lifecycle from yesterday
where date = current_date - 1
where is_current_state = true
),
upb_aggregation as (
select

View file

@ -53,6 +53,7 @@ with
deal_historic_booking_dates as (
select
d.date,
d.is_yesterday,
ikdd.id_deal,
ikdd.is_deal_in_hubspot,
min(ikdd.client_type) as client_type,
@ -66,11 +67,12 @@ with
booked_days_per_deal b
on ikdd.id_deal = b.id_deal
and d.date >= b.created_date_utc
group by d.date, ikdd.id_deal, ikdd.is_deal_in_hubspot
group by d.date, d.is_yesterday, ikdd.id_deal, ikdd.is_deal_in_hubspot
),
deal_historic_features as (
select
hhbf.date,
case when hhbf.is_yesterday then true else false end as is_current_state,
hhbf.id_deal,
hhbf.is_deal_in_hubspot,
hhbf.creation_date_utc,
@ -151,6 +153,7 @@ with
)
select
date,
is_current_state,
id_deal,
creation_date_utc,
first_time_booked_date_utc,