mtd and weekly agg guest payments

This commit is contained in:
Joaquin Ossa 2024-11-07 12:15:52 +01:00
parent c89c72aace
commit 11e1804db0
3 changed files with 111 additions and 1 deletions

View file

@ -0,0 +1,29 @@
{% set dimensions = get_kpi_dimensions_per_model(
"PAYMENT_DATE_ATTRIBUTED_GUEST_PAYMENTS"
) %}
{{
config(
materialized="table", unique_key=["end_date", "dimension", "dimension_value"]
)
}}
{% for dimension in dimensions %}
select
-- Unique Key --
start_date,
end_date,
{{ dimension.dimension }} as dimension,
{{ dimension.dimension_value }} as dimension_value,
-- Metrics --
sum(deposit_fees_in_gbp) as deposit_fees_in_gbp,
sum(waiver_payments_in_gbp) as waiver_payments_in_gbp,
sum(checkin_cover_fees_in_gbp) as checkin_cover_fees_in_gbp,
sum(total_guest_payments_in_gbp) as total_guest_payments_in_gbp
from {{ ref("int_kpis__metric_weekly_guest_payments") }}
group by 1, 2, 3, 4
{% if not loop.last %}
union all
{% endif %}
{% endfor %}