Added boolean
This commit is contained in:
parent
3833f3e92d
commit
b138e0c626
2 changed files with 5 additions and 2 deletions
|
|
@ -14,7 +14,7 @@ with
|
||||||
select *
|
select *
|
||||||
from {{ ref("int_kpis__lifecycle_daily_deal") }}
|
from {{ ref("int_kpis__lifecycle_daily_deal") }}
|
||||||
-- Only retrieve deals lifecycle from yesterday
|
-- Only retrieve deals lifecycle from yesterday
|
||||||
where date = current_date - 1
|
where is_current_state = true
|
||||||
),
|
),
|
||||||
upb_aggregation as (
|
upb_aggregation as (
|
||||||
select
|
select
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ with
|
||||||
deal_historic_booking_dates as (
|
deal_historic_booking_dates as (
|
||||||
select
|
select
|
||||||
d.date,
|
d.date,
|
||||||
|
d.is_yesterday,
|
||||||
ikdd.id_deal,
|
ikdd.id_deal,
|
||||||
ikdd.is_deal_in_hubspot,
|
ikdd.is_deal_in_hubspot,
|
||||||
min(ikdd.client_type) as client_type,
|
min(ikdd.client_type) as client_type,
|
||||||
|
|
@ -66,11 +67,12 @@ with
|
||||||
booked_days_per_deal b
|
booked_days_per_deal b
|
||||||
on ikdd.id_deal = b.id_deal
|
on ikdd.id_deal = b.id_deal
|
||||||
and d.date >= b.created_date_utc
|
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 (
|
deal_historic_features as (
|
||||||
select
|
select
|
||||||
hhbf.date,
|
hhbf.date,
|
||||||
|
case when hhbf.is_yesterday then true else false end as is_current_state,
|
||||||
hhbf.id_deal,
|
hhbf.id_deal,
|
||||||
hhbf.is_deal_in_hubspot,
|
hhbf.is_deal_in_hubspot,
|
||||||
hhbf.creation_date_utc,
|
hhbf.creation_date_utc,
|
||||||
|
|
@ -151,6 +153,7 @@ with
|
||||||
)
|
)
|
||||||
select
|
select
|
||||||
date,
|
date,
|
||||||
|
is_current_state,
|
||||||
id_deal,
|
id_deal,
|
||||||
creation_date_utc,
|
creation_date_utc,
|
||||||
first_time_booked_date_utc,
|
first_time_booked_date_utc,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue