reduced dates

This commit is contained in:
Joaquin Ossa 2024-11-17 16:41:04 +01:00
parent c209e670ca
commit e01f189d7a
2 changed files with 21 additions and 0 deletions

View file

@ -29,6 +29,7 @@ with
from {{ ref("int_kpis__metric_daily_check_in_attributed_guest_journeys") }} gj from {{ ref("int_kpis__metric_daily_check_in_attributed_guest_journeys") }} gj
group by gj.date, gj.has_payment, gj.has_id_check 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 ( guest_payment_metrics as (
select select
gp.date, gp.date,
@ -38,6 +39,7 @@ with
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 {{ ref("int_kpis__metric_daily_guest_payments") }} gp from {{ ref("int_kpis__metric_daily_guest_payments") }} gp
where gp.date < current_date
group by gp.date, gp.has_id_check group by gp.date, gp.has_id_check
), ),
guest_kpis as ( guest_kpis as (
@ -68,6 +70,8 @@ with
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 = {{ has_payment_true }} and dd.has_payment = {{ has_payment_true }}
cross join max_guest_date m
where dd.date_day <= m.max_date
) )
select select

View file

@ -264,3 +264,20 @@ exposures:
owner: owner:
name: Oriol Roqué name: Oriol Roqué
email: oriol.roque@superhog.com email: oriol.roque@superhog.com
- name: guest_kpis
label: Guest KPIs
type: dashboard
maturity: medium
url: to_be_defined
description: |
A PBI report that displays the main KPIs followed by the
guest Squad. This includes guest journey metrics and revenue
by guest payments by a set of dimensions with a daily granularity.
depends_on:
- ref('kpis__product_guest_daily_metrics')
owner:
name: Joaquin Ossa
email: joaquin.ossa@superhog.com