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

@ -1,4 +1,6 @@
{% set dimensions = get_kpi_dimensions_per_model("GUEST_PAYMENTS") %}
{% set dimensions = get_kpi_dimensions_per_model(
"PAYMENT_DATE_ATTRIBUTED_GUEST_PAYMENTS"
) %}
{{
config(

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 %}

View file

@ -2448,6 +2448,7 @@ models:
- by_number_of_listings
- by_billing_country
- by_deal
- by_has_id_check
- name: dimension_value
data_type: string
@ -2479,6 +2480,84 @@ models:
The month-to-date total payments paid by guests, without taxes, in GBP
for a given range date, dimension and value.
- name: int_kpis__agg_weekly_guest_payments
description: |
This model computes the dimension aggregation for
Weekly Guest Payments.
The primary key of this model is end_date, dimension
and dimension_value.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- end_date
- dimension
- dimension_value
columns:
- name: start_date
data_type: date
description: |
The start date of the time range considered for the metrics in this record.
tests:
- not_null
- name: end_date
data_type: date
description: |
The end date of the time range considered for the metrics in this record.
tests:
- not_null
- name: dimension
data_type: string
description: The dimension or granularity of the metrics.
tests:
- assert_dimension_completeness:
metric_column_names:
- deposit_fees_in_gbp
- waiver_payments_in_gbp
- checkin_cover_fees_in_gbp
- total_guest_payments_in_gbp
- accepted_values:
values:
- global
- by_number_of_listings
- by_billing_country
- by_deal
- by_has_id_check
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
tests:
- not_null
- name: deposit_fees_in_gbp
data_type: decimal
description: |
The weekly deposit fees paid by guests, without taxes, in GBP
for a given range date, dimension and value.
- name: waiver_payments_in_gbp
data_type: decimal
description: |
The weekly waiver payments paid by guests, without taxes, in GBP
for a given range date, dimension and value.
- name: checkin_cover_fees_in_gbp
data_type: decimal
description: |
The weekly checkin cover fees paid by guests, without taxes, in GBP
for a given range date, dimension and value.
- name: total_guest_payments_in_gbp
data_type: decimal
description: |
The weekly total payments paid by guests, without taxes, in GBP
for a given range date, dimension and value.
- name: int_kpis__metric_daily_check_out_bookings
description: |
This model computes the Daily Check-out Bookings at the deepest granularity.