fixed model copy paste

This commit is contained in:
Joaquin Ossa 2024-11-26 09:54:35 +01:00
parent 2404905da1
commit 6b5b7d2d5a

View file

@ -1,3 +1,5 @@
{% set has_payment_true = "('With Payment')" %}
with with
guest_journey_metrics as ( guest_journey_metrics as (
select select
@ -25,8 +27,7 @@ with
/ sum(gj.count_csat_score) / sum(gj.count_csat_score)
else null else null
end as average_csat_score end as average_csat_score
from from {{ ref("int_kpis__metric_daily_check_in_attributed_guest_journeys") }} gj
"intermediate"."int_kpis__metric_daily_check_in_attributed_guest_journeys" gj
group by group by
gj.date, gj.date,
gj.has_payment, gj.has_payment,
@ -42,7 +43,7 @@ with
sum(gp.waiver_payments_in_gbp) as waiver_payments_in_gbp, sum(gp.waiver_payments_in_gbp) as waiver_payments_in_gbp,
sum(gp.checkin_cover_fees_in_gbp) as checkin_cover_fees_in_gbp, sum(gp.checkin_cover_fees_in_gbp) as checkin_cover_fees_in_gbp,
sum(gp.total_guest_payments_in_gbp) as total_guest_payments_in_gbp sum(gp.total_guest_payments_in_gbp) as total_guest_payments_in_gbp
from "intermediate"."int_kpis__metric_daily_guest_payments" gp from {{ ref("int_kpis__metric_daily_guest_payments") }} gp
where gp.date < current_date where gp.date < current_date
group by gp.date, gp.has_id_check, gp.main_billing_country_iso_3_per_deal group by gp.date, gp.has_id_check, gp.main_billing_country_iso_3_per_deal
), ),
@ -65,7 +66,7 @@ with
gp.waiver_payments_in_gbp, gp.waiver_payments_in_gbp,
gp.checkin_cover_fees_in_gbp, gp.checkin_cover_fees_in_gbp,
gp.total_guest_payments_in_gbp gp.total_guest_payments_in_gbp
from "intermediate"."int_kpis__dimension_date_product_guest" dd from {{ ref("int_kpis__dimension_date_product_guest") }} dd
left join left join
guest_journey_metrics gj guest_journey_metrics gj
on gj.date = dd.date_day on gj.date = dd.date_day
@ -77,7 +78,7 @@ with
guest_payment_metrics gp guest_payment_metrics gp
on gp.date = dd.date_day on gp.date = dd.date_day
and gp.has_id_check = dd.has_id_check and gp.has_id_check = dd.has_id_check
and dd.has_payment = ('With Payment') and dd.has_payment = {{ has_payment_true }}
and gp.main_billing_country_iso_3_per_deal and gp.main_billing_country_iso_3_per_deal
= dd.main_billing_country_iso_3_per_deal = dd.main_billing_country_iso_3_per_deal
-- Restricts the records by date being in the past or in the next following 12 -- Restricts the records by date being in the past or in the next following 12