save wip of started GJ
This commit is contained in:
parent
03797827a4
commit
6ae900530c
1 changed files with 33 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
||||||
|
{{ config(materialized="table", unique_key=["date", "id_deal"]) }}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
b.check_in_date_utc as date,
|
||||||
|
coalesce(icuh.id_deal, 'UNSET') as id_deal,
|
||||||
|
-- Dimensions --
|
||||||
|
coalesce(
|
||||||
|
icd.main_billing_country_iso_3_per_deal, 'UNSET'
|
||||||
|
) as main_billing_country_iso_3_per_deal,
|
||||||
|
coalesce(
|
||||||
|
icmas.active_accommodations_per_deal_segmentation, 'UNSET'
|
||||||
|
) as active_accommodations_per_deal_segmentation,
|
||||||
|
case
|
||||||
|
(
|
||||||
|
when vp.id_verification_to_payment is null then false else true
|
||||||
|
) as has_payment,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct vr.id_verification_request) as started_guest_journeys
|
||||||
|
from {{ ref("int_core__verification_requests") }} as vr
|
||||||
|
inner join {{ ref("int_core__bookings") }} as b on b.id_verification_request = vr.id_verification_request
|
||||||
|
left join
|
||||||
|
{{ ref("int_core__user_host") }} as icuh
|
||||||
|
on vr.id_user_host = icuh.id_user_host
|
||||||
|
left join {{ ref("int_core__deal") }} as icd on icuh.id_deal = icd.id_deal
|
||||||
|
left join
|
||||||
|
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas
|
||||||
|
on icuh.id_deal = icmas.id_deal
|
||||||
|
and vr.verification_estimated_started_date_utc = icmas.date
|
||||||
|
left join
|
||||||
|
{{ ref("int_core__verification_payments") }} as vp
|
||||||
|
on vp.id_verification_request = vr.id_verification_request
|
||||||
|
where b.check_in_date_utc is not null
|
||||||
|
group by 1, 2, 3, 4, 5
|
||||||
Loading…
Add table
Add a link
Reference in a new issue