Merged PR 4298: Split Check-Out bookings by Dash Source

# Description

Adds new category Dash Source for Check-Out bookings KPIs

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #27356
This commit is contained in:
Oriol Roqué Paniagua 2025-02-06 10:53:24 +00:00
parent 85fa58f5a9
commit b569db3468
5 changed files with 52 additions and 6 deletions

View file

@ -131,7 +131,7 @@ Provides a general assignement for the Dimensions available for each KPI
{% endif %}
{# Add entity-specific dimensions #}
{% if entity_name == "CREATED_BOOKINGS" %}
{% if entity_name in ["CREATED_BOOKINGS", "CHECK_OUT_BOOKINGS"] %}
{% set additional_dimensions = additional_dimensions + [dim_dash()] %}
{% endif %}

View file

@ -1,8 +1,11 @@
{{ config(materialized="table", unique_key=["date", "id_deal"]) }}
{{ config(materialized="table", unique_key=["date", "id_deal", "dash_source"]) }}
select
-- Unique Key --
icb.check_out_date_utc as date,
coalesce(icuh.id_deal, 'UNSET') as id_deal,
case
when icbtpb.id_booking is not null then 'New Dash' else 'Old Dash'
end as dash_source,
-- Dimensions --
coalesce(
icd.main_billing_country_iso_3_per_deal, 'UNSET'
@ -20,4 +23,7 @@ left join
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas
on icuh.id_deal = icmas.id_deal
and icb.check_out_date_utc = icmas.date
group by 1, 2, 3, 4
left join
{{ ref("int_core__booking_to_product_bundle") }} as icbtpb
on icb.id_booking = icbtpb.id_booking
group by 1, 2, 3, 4, 5

View file

@ -14,6 +14,7 @@ select
d.first_day_month as start_date,
d.date as end_date,
b.id_deal,
b.dash_source,
b.active_accommodations_per_deal_segmentation,
-- Dimensions --
b.main_billing_country_iso_3_per_deal,
@ -24,4 +25,4 @@ left join
{{ ref("int_kpis__metric_daily_check_out_bookings") }} b
on date_trunc('month', b.date)::date = d.first_day_month
where d.is_end_of_month = true and b.id_deal is not null
group by 1, 2, 3, 4, 5
group by 1, 2, 3, 4, 5, 6

View file

@ -14,6 +14,7 @@ select
d.first_day_month as start_date,
d.date as end_date,
b.id_deal,
b.dash_source,
b.active_accommodations_per_deal_segmentation,
-- Dimensions --
b.main_billing_country_iso_3_per_deal,
@ -25,4 +26,4 @@ left join
on date_trunc('month', b.date)::date = d.first_day_month
and extract(day from b.date) <= d.day
where d.is_month_to_date = true and b.id_deal is not null
group by 1, 2, 3, 4, 5
group by 1, 2, 3, 4, 5, 6

View file

@ -2744,13 +2744,15 @@ models:
The unique key corresponds to the deepest granularity of the model,
in this case:
- date,
- id_deal.
- id_deal,
- dash_source.
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_deal
- dash_source
columns:
- name: date
@ -2765,6 +2767,16 @@ models:
data_tests:
- not_null
- name: dash_source
data_type: string
description: Dashboard source, either old or new.
data_tests:
- not_null
- accepted_values:
values:
- "New Dash"
- "Old Dash"
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
@ -2804,6 +2816,7 @@ models:
The unique key corresponds to:
- end_date,
- id_deal,
- dash_source,
- active_accommodations_per_deal_segmentation.
data_tests:
@ -2811,6 +2824,7 @@ models:
combination_of_columns:
- end_date
- id_deal
- dash_source
- active_accommodations_per_deal_segmentation
columns:
@ -2834,6 +2848,16 @@ models:
data_tests:
- not_null
- name: dash_source
data_type: string
description: Dashboard source, either old or new.
data_tests:
- not_null
- accepted_values:
values:
- "New Dash"
- "Old Dash"
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
@ -2874,6 +2898,7 @@ models:
The unique key corresponds to:
- end_date,
- id_deal,
- dash_source,
- active_accommodations_per_deal_segmentation.
data_tests:
@ -2881,6 +2906,7 @@ models:
combination_of_columns:
- end_date
- id_deal
- dash_source
- active_accommodations_per_deal_segmentation
columns:
@ -2904,6 +2930,16 @@ models:
data_tests:
- not_null
- name: dash_source
data_type: string
description: Dashboard source, either old or new.
data_tests:
- not_null
- accepted_values:
values:
- "New Dash"
- "Old Dash"
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
@ -2975,6 +3011,7 @@ models:
- global
- by_number_of_listings
- by_billing_country
- by_dash_source
- by_deal
- name: dimension_value
@ -3029,6 +3066,7 @@ models:
- global
- by_number_of_listings
- by_billing_country
- by_dash_source
- by_deal
- name: dimension_value