aggregated to agg

This commit is contained in:
Joaquin 2024-11-05 12:17:26 +01:00
parent f601b69c7d
commit 092e37d58c
28 changed files with 94 additions and 94 deletions

View file

@ -1,9 +1,9 @@
{{ config(materialized="table", unique_key=["date", "id_deal"]) }} {{ config(materialized="table", unique_key=["date", "id_deal"]) }}
with with
int_monthly_aggregated_metrics_history_by_deal as ( int_monthly_agg_metrics_history_by_deal as (
select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }}
), ),
aggregated_metrics_by_deal_over_12_months as ( agg_metrics_by_deal_over_12_months as (
select select
am.date, am.date,
am.id_deal, am.id_deal,
@ -28,7 +28,7 @@ with
order by am.date order by am.date
rows between 12 preceding and 1 preceding rows between 12 preceding and 1 preceding
) as sum_listings_booked_in_month_preceding_12_months ) as sum_listings_booked_in_month_preceding_12_months
from int_monthly_aggregated_metrics_history_by_deal am from int_monthly_agg_metrics_history_by_deal am
), ),
global_computation_over_12_months as ( global_computation_over_12_months as (
select select
@ -73,7 +73,7 @@ with
) over (partition by ambd.date) ) over (partition by ambd.date)
as avg_global_listings_booked_in_month_preceding_12_months as avg_global_listings_booked_in_month_preceding_12_months
from aggregated_metrics_by_deal_over_12_months ambd from agg_metrics_by_deal_over_12_months ambd
) )
select select
id_deal, id_deal,

View file

@ -10,47 +10,47 @@ with
), ),
created_bookings as ( created_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_created_bookings") }} from {{ ref("int_kpis__agg_monthly_created_bookings") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
check_out_bookings as ( check_out_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_check_out_bookings") }} from {{ ref("int_kpis__agg_monthly_check_out_bookings") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
cancelled_bookings as ( cancelled_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_cancelled_bookings") }} from {{ ref("int_kpis__agg_monthly_cancelled_bookings") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
billable_bookings as ( billable_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_billable_bookings") }} from {{ ref("int_kpis__agg_monthly_billable_bookings") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
created_guest_journeys as ( created_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_created_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_created_guest_journeys") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
started_guest_journeys as ( started_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_started_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_started_guest_journeys") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
completed_guest_journeys as ( completed_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_completed_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_completed_guest_journeys") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
guest_journeys_with_payment as ( guest_journeys_with_payment as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_guest_journeys_with_payment") }} from {{ ref("int_kpis__agg_monthly_guest_journeys_with_payment") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
guest_payments as ( guest_payments as (
select * select *
from {{ ref("int_kpis__aggregated_monthly_guest_payments") }} from {{ ref("int_kpis__agg_monthly_guest_payments") }}
where dimension in ('by_deal') and dimension_value <> 'UNSET' where dimension in ('by_deal') and dimension_value <> 'UNSET'
), ),
int_xero__monthly_invoicing_history_by_deal as ( int_xero__monthly_invoicing_history_by_deal as (

View file

@ -1,7 +1,7 @@
{{ config(materialized="table", unique_key=["date", "id_deal"]) }} {{ config(materialized="table", unique_key=["date", "id_deal"]) }}
with with
int_monthly_aggregated_metrics_history_by_deal as ( int_monthly_agg_metrics_history_by_deal as (
select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }}
), ),
int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}), int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}),
deal_history_from_previous_months as ( deal_history_from_previous_months as (
@ -17,7 +17,7 @@ with
coalesce(total_revenue_in_gbp, 0) as revenue_in_gbp, coalesce(total_revenue_in_gbp, 0) as revenue_in_gbp,
coalesce(created_bookings, 0) as created_bookings, coalesce(created_bookings, 0) as created_bookings,
coalesce(listings_booked_in_month, 0) as listings_booked_in_month coalesce(listings_booked_in_month, 0) as listings_booked_in_month
from int_monthly_aggregated_metrics_history_by_deal am from int_monthly_agg_metrics_history_by_deal am
-- Do not show data of ongoing month -- Do not show data of ongoing month
where am.date < date_trunc('month', current_date)::date where am.date < date_trunc('month', current_date)::date
), ),
@ -71,7 +71,7 @@ with
coalesce(sum(previous_twelve_months.revenue_in_gbp), 0), 0 coalesce(sum(previous_twelve_months.revenue_in_gbp), 0), 0
) as effective_deal_revenue_12_months_window ) as effective_deal_revenue_12_months_window
from deal_history_from_previous_months as given_month from deal_history_from_previous_months as given_month
-- Retrieve aggregated data from same deal from the previous twelve -- Retrieve agg data from same deal from the previous twelve
-- months -- months
left join left join
deal_history_from_previous_months as previous_twelve_months deal_history_from_previous_months as previous_twelve_months
@ -81,7 +81,7 @@ with
and given_month.first_day_month and given_month.first_day_month
>= previous_twelve_months.first_day_month + interval '1 months' >= previous_twelve_months.first_day_month + interval '1 months'
group by 1, 2 group by 1, 2
) as aggregated_revenue_data_before_partition ) as agg_revenue_data_before_partition
), ),
metrics_attribution_to_given_month_per_deal as ( metrics_attribution_to_given_month_per_deal as (
select select
@ -100,10 +100,10 @@ with
previous_2_month.first_day_month as previous_2_month_first_day_month, previous_2_month.first_day_month as previous_2_month_first_day_month,
previous_12_month.first_day_month as previous_12_month_first_day_month, previous_12_month.first_day_month as previous_12_month_first_day_month,
previous_13_month.first_day_month as previous_13_month_first_day_month, previous_13_month.first_day_month as previous_13_month_first_day_month,
aggregated_12m_window.from_first_day_month agg_12m_window.from_first_day_month
as aggregated_revenue_from_first_day_month, as agg_revenue_from_first_day_month,
aggregated_12m_window.to_first_day_month agg_12m_window.to_first_day_month
as aggregated_revenue_to_first_day_month, as agg_revenue_to_first_day_month,
-- Revenue -- -- Revenue --
given_month.revenue_in_gbp as given_month_revenue_in_gbp, given_month.revenue_in_gbp as given_month_revenue_in_gbp,
@ -154,54 +154,54 @@ with
-- 12 Months Window (Account Size) -- -- 12 Months Window (Account Size) --
-- Bookings -- -- Bookings --
aggregated_12m_window.deal_created_bookings_12_months_window, agg_12m_window.deal_created_bookings_12_months_window,
aggregated_12m_window.global_created_bookings_12_months_window, agg_12m_window.global_created_bookings_12_months_window,
coalesce( coalesce(
cast( cast(
aggregated_12m_window.deal_created_bookings_12_months_window agg_12m_window.deal_created_bookings_12_months_window
as decimal as decimal
) / nullif( ) / nullif(
aggregated_12m_window.global_created_bookings_12_months_window, 0 agg_12m_window.global_created_bookings_12_months_window, 0
), ),
0 0
) as deal_contribution_share_to_global_created_bookings, ) as deal_contribution_share_to_global_created_bookings,
aggregated_12m_window.deal_contribution_rank_to_global_created_bookings, agg_12m_window.deal_contribution_rank_to_global_created_bookings,
-- Listings -- -- Listings --
round( round(
aggregated_12m_window.deal_avg_listings_booked_in_month_12_months_window, agg_12m_window.deal_avg_listings_booked_in_month_12_months_window,
2 2
) as deal_avg_listings_booked_in_month_12_months_window, ) as deal_avg_listings_booked_in_month_12_months_window,
round( round(
aggregated_12m_window.global_avg_listings_booked_in_month_12_months_window, agg_12m_window.global_avg_listings_booked_in_month_12_months_window,
2 2
) as global_avg_listings_booked_in_month_12_months_window, ) as global_avg_listings_booked_in_month_12_months_window,
coalesce( coalesce(
cast( cast(
aggregated_12m_window.deal_avg_listings_booked_in_month_12_months_window agg_12m_window.deal_avg_listings_booked_in_month_12_months_window
as decimal as decimal
) / nullif( ) / nullif(
aggregated_12m_window.global_avg_listings_booked_in_month_12_months_window, agg_12m_window.global_avg_listings_booked_in_month_12_months_window,
0 0
), ),
0 0
) as deal_contribution_share_to_global_avg_listings_booked_in_month, ) as deal_contribution_share_to_global_avg_listings_booked_in_month,
aggregated_12m_window.deal_contribution_rank_to_global_avg_listings_booked_in_month, agg_12m_window.deal_contribution_rank_to_global_avg_listings_booked_in_month,
-- Revenue -- -- Revenue --
aggregated_12m_window.deal_revenue_12_months_window, agg_12m_window.deal_revenue_12_months_window,
aggregated_12m_window.effective_deal_revenue_12_months_window, agg_12m_window.effective_deal_revenue_12_months_window,
aggregated_12m_window.effective_global_revenue_12_months_window, agg_12m_window.effective_global_revenue_12_months_window,
coalesce( coalesce(
cast( cast(
aggregated_12m_window.effective_deal_revenue_12_months_window agg_12m_window.effective_deal_revenue_12_months_window
as decimal as decimal
) / nullif( ) / nullif(
aggregated_12m_window.effective_global_revenue_12_months_window, 0 agg_12m_window.effective_global_revenue_12_months_window, 0
), ),
0 0
) as deal_contribution_share_to_global_revenue, ) as deal_contribution_share_to_global_revenue,
aggregated_12m_window.deal_contribution_rank_to_global_revenue agg_12m_window.deal_contribution_rank_to_global_revenue
from deal_history_from_previous_months as given_month from deal_history_from_previous_months as given_month
-- Retrieve monthly data from same deal and previous month -- Retrieve monthly data from same deal and previous month
@ -232,9 +232,9 @@ with
and previous_13_month.id_deal = given_month.id_deal and previous_13_month.id_deal = given_month.id_deal
-- Retrieve aggregation over 12 previous months -- Retrieve aggregation over 12 previous months
left join left join
revenue_12_months_window_aggregation_per_deal aggregated_12m_window revenue_12_months_window_aggregation_per_deal agg_12m_window
on aggregated_12m_window.id_deal = given_month.id_deal on agg_12m_window.id_deal = given_month.id_deal
and aggregated_12m_window.first_day_month = given_month.first_day_month and agg_12m_window.first_day_month = given_month.first_day_month
), ),
growth_score_computation as ( growth_score_computation as (
select select
@ -250,8 +250,8 @@ with
m.previous_2_month_first_day_month, m.previous_2_month_first_day_month,
m.previous_12_month_first_day_month, m.previous_12_month_first_day_month,
m.previous_13_month_first_day_month, m.previous_13_month_first_day_month,
m.aggregated_revenue_from_first_day_month, m.agg_revenue_from_first_day_month,
m.aggregated_revenue_to_first_day_month, m.agg_revenue_to_first_day_month,
m.given_month_revenue_in_gbp, m.given_month_revenue_in_gbp,
m.previous_1_month_revenue_in_gbp, m.previous_1_month_revenue_in_gbp,
@ -358,8 +358,8 @@ select
gsc.previous_2_month_first_day_month, gsc.previous_2_month_first_day_month,
gsc.previous_12_month_first_day_month, gsc.previous_12_month_first_day_month,
gsc.previous_13_month_first_day_month, gsc.previous_13_month_first_day_month,
gsc.aggregated_revenue_from_first_day_month, gsc.agg_revenue_from_first_day_month,
gsc.aggregated_revenue_to_first_day_month, gsc.agg_revenue_to_first_day_month,
gsc.given_month_revenue_in_gbp, gsc.given_month_revenue_in_gbp,
gsc.previous_1_month_revenue_in_gbp, gsc.previous_1_month_revenue_in_gbp,

View file

@ -6,104 +6,104 @@ previous year for each line & computing relative increment. --
with with
created_bookings as ( created_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_created_bookings") }} from {{ ref("int_kpis__agg_mtd_created_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_created_bookings") }} from {{ ref("int_kpis__agg_monthly_created_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
check_out_bookings as ( check_out_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_check_out_bookings") }} from {{ ref("int_kpis__agg_mtd_check_out_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_check_out_bookings") }} from {{ ref("int_kpis__agg_monthly_check_out_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
cancelled_bookings as ( cancelled_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_cancelled_bookings") }} from {{ ref("int_kpis__agg_mtd_cancelled_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_cancelled_bookings") }} from {{ ref("int_kpis__agg_monthly_cancelled_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
billable_bookings as ( billable_bookings as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_billable_bookings") }} from {{ ref("int_kpis__agg_mtd_billable_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_billable_bookings") }} from {{ ref("int_kpis__agg_monthly_billable_bookings") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
created_guest_journeys as ( created_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_created_guest_journeys") }} from {{ ref("int_kpis__agg_mtd_created_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_created_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_created_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
started_guest_journeys as ( started_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_started_guest_journeys") }} from {{ ref("int_kpis__agg_mtd_started_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_started_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_started_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
completed_guest_journeys as ( completed_guest_journeys as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_completed_guest_journeys") }} from {{ ref("int_kpis__agg_mtd_completed_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_completed_guest_journeys") }} from {{ ref("int_kpis__agg_monthly_completed_guest_journeys") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
), ),
guest_journeys_with_payment as ( guest_journeys_with_payment as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_guest_journeys_with_payment") }} from {{ ref("int_kpis__agg_mtd_guest_journeys_with_payment") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_guest_journeys_with_payment") }} from {{ ref("int_kpis__agg_monthly_guest_journeys_with_payment") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
@ -114,13 +114,13 @@ with
int_mtd_deal_metrics as (select * from {{ ref("int_mtd_deal_metrics") }}), int_mtd_deal_metrics as (select * from {{ ref("int_mtd_deal_metrics") }}),
guest_payments as ( guest_payments as (
select * select *
from {{ ref("int_kpis__aggregated_mtd_guest_payments") }} from {{ ref("int_kpis__agg_mtd_guest_payments") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'
union all union all
select * select *
from {{ ref("int_kpis__aggregated_monthly_guest_payments") }} from {{ ref("int_kpis__agg_monthly_guest_payments") }}
where where
dimension in ('global', 'by_number_of_listings', 'by_billing_country') dimension in ('global', 'by_number_of_listings', 'by_billing_country')
and dimension_value <> 'UNSET' and dimension_value <> 'UNSET'

View file

@ -445,7 +445,7 @@ models:
Count of accumulated bookings created in a given month up to the Count of accumulated bookings created in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_created_bookings - name: int_kpis__agg_monthly_created_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Created Bookings. Monthly Created Bookings.
@ -499,7 +499,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly created bookings for a given date, dimension and value. description: The monthly created bookings for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_created_bookings - name: int_kpis__agg_mtd_created_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Created Bookings. Month-To-Date Created Bookings.
@ -749,7 +749,7 @@ models:
Count of accumulated guest journeys created in a given month up to the Count of accumulated guest journeys created in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_created_guest_journeys - name: int_kpis__agg_monthly_created_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Created Guest Journeys. Monthly Created Guest Journeys.
@ -802,7 +802,7 @@ models:
data_type: bigint data_type: bigint
description: The monthtly created guest journeys for a given date, dimension and value. description: The monthtly created guest journeys for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_created_guest_journeys - name: int_kpis__agg_mtd_created_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Created Guest Journeys. Month-To-Date Created Guest Journeys.
@ -1051,7 +1051,7 @@ models:
Count of accumulated guest journeys started in a given month up to the Count of accumulated guest journeys started in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_started_guest_journeys - name: int_kpis__agg_monthly_started_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Started Guest Journeys. Monthly Started Guest Journeys.
@ -1104,7 +1104,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly started guest journeys for a given date, dimension and value. description: The monthly started guest journeys for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_started_guest_journeys - name: int_kpis__agg_mtd_started_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Started Guest Journeys. Month-To-Date Started Guest Journeys.
@ -1353,7 +1353,7 @@ models:
Count of accumulated guest journeys completed in a given month up to the Count of accumulated guest journeys completed in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_completed_guest_journeys - name: int_kpis__agg_monthly_completed_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Completed Guest Journeys. Monthly Completed Guest Journeys.
@ -1406,7 +1406,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly completed guest journeys for a given date, dimension and value. description: The monthly completed guest journeys for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_completed_guest_journeys - name: int_kpis__agg_mtd_completed_guest_journeys
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Completed Guest Journeys. Month-To-Date Completed Guest Journeys.
@ -1655,7 +1655,7 @@ models:
Count of accumulated guest journeys completed in a given month up to the Count of accumulated guest journeys completed in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_guest_journeys_with_payment - name: int_kpis__agg_monthly_guest_journeys_with_payment
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Guest Journeys with Payment. Monthly Guest Journeys with Payment.
@ -1708,7 +1708,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly guest journeys with payment for a given date, dimension and value. description: The monthly guest journeys with payment for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_guest_journeys_with_payment - name: int_kpis__agg_mtd_guest_journeys_with_payment
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Guest Journeys with Payment. Month-To-Date Guest Journeys with Payment.
@ -2012,7 +2012,7 @@ models:
Sum of accumulated total payments paid by guests, without taxes, Sum of accumulated total payments paid by guests, without taxes,
in GBP in a given month up to the given date and per specified dimension. in GBP in a given month up to the given date and per specified dimension.
- name: int_kpis__aggregated_monthly_guest_payments - name: int_kpis__agg_monthly_guest_payments
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Guest Payments. Monthly Guest Payments.
@ -2091,7 +2091,7 @@ models:
The monthly total payments paid by guests, without taxes, in GBP The monthly total payments paid by guests, without taxes, in GBP
for a given range date, dimension and value. for a given range date, dimension and value.
- name: int_kpis__aggregated_mtd_guest_payments - name: int_kpis__agg_mtd_guest_payments
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Guest Payments. Month-To-Date Guest Payments.
@ -2366,7 +2366,7 @@ models:
Count of accumulated bookings checked-out in a given month up to the Count of accumulated bookings checked-out in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_check_out_bookings - name: int_kpis__agg_monthly_check_out_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Check-out Bookings. Monthly Check-out Bookings.
@ -2419,7 +2419,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly checked-out bookings for a given date, dimension and value. description: The monthly checked-out bookings for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_check_out_bookings - name: int_kpis__agg_mtd_check_out_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Check-out Bookings. Month-To-Date Check-out Bookings.
@ -2668,7 +2668,7 @@ models:
Count of accumulated bookings billable in a given month up to the Count of accumulated bookings billable in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_billable_bookings - name: int_kpis__agg_monthly_billable_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Billable Bookings. Monthly Billable Bookings.
@ -2721,7 +2721,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly billable bookings for a given date, dimension and value. description: The monthly billable bookings for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_billable_bookings - name: int_kpis__agg_mtd_billable_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Billable Bookings. Month-To-Date Billable Bookings.
@ -2970,7 +2970,7 @@ models:
Count of accumulated bookings cancelled in a given month up to the Count of accumulated bookings cancelled in a given month up to the
given date and per specified dimension. given date and per specified dimension.
- name: int_kpis__aggregated_monthly_cancelled_bookings - name: int_kpis__agg_monthly_cancelled_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Monthly Cancelled Bookings. Monthly Cancelled Bookings.
@ -3023,7 +3023,7 @@ models:
data_type: bigint data_type: bigint
description: The monthly cancelled bookings for a given date, dimension and value. description: The monthly cancelled bookings for a given date, dimension and value.
- name: int_kpis__aggregated_mtd_cancelled_bookings - name: int_kpis__agg_mtd_cancelled_bookings
description: | description: |
This model computes the dimension aggregation for This model computes the dimension aggregation for
Month-To-Date Cancelled Bookings. Month-To-Date Cancelled Bookings.

View file

@ -113,8 +113,8 @@ exposures:
Additionally, it allows to retrieve similar KPIs at Deal level. Additionally, it allows to retrieve similar KPIs at Deal level.
depends_on: depends_on:
- ref('mtd_aggregated_metrics') - ref('mtd_agg_metrics')
- ref('monthly_aggregated_metrics_history_by_deal') - ref('monthly_agg_metrics_history_by_deal')
owner: owner:
name: Oriol Roqué name: Oriol Roqué

View file

@ -1,6 +1,6 @@
with with
int_monthly_aggregated_metrics_history_by_deal as ( int_monthly_agg_metrics_history_by_deal as (
select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }}
) )
select select
@ -113,4 +113,4 @@ select
deposit_fees_in_gbp as deposit_fees_in_gbp, deposit_fees_in_gbp as deposit_fees_in_gbp,
waiver_payments_in_gbp as waiver_payments_in_gbp, waiver_payments_in_gbp as waiver_payments_in_gbp,
checkin_cover_fees_in_gbp as checkin_cover_fees_in_gbp checkin_cover_fees_in_gbp as checkin_cover_fees_in_gbp
from int_monthly_aggregated_metrics_history_by_deal from int_monthly_agg_metrics_history_by_deal

View file

@ -11,9 +11,9 @@ with
{% endif %} {% endif %}
{% endfor %} {% endfor %}
), ),
int_mtd_aggregated_metrics as ( int_mtd_agg_metrics as (
select m.*, d.dimension_display select m.*, d.dimension_display
from {{ ref("int_mtd_aggregated_metrics") }} m from {{ ref("int_mtd_agg_metrics") }} m
-- The following clause limits the display execution -- The following clause limits the display execution
-- to only include those dimensions configured to -- to only include those dimensions configured to
-- appear for production purposes -- appear for production purposes
@ -38,7 +38,7 @@ select
previous_year_value as previous_year_value, previous_year_value as previous_year_value,
relative_increment as relative_increment, relative_increment as relative_increment,
relative_increment_with_sign_format as relative_increment_with_sign_format relative_increment_with_sign_format as relative_increment_with_sign_format
from int_mtd_aggregated_metrics from int_mtd_agg_metrics
/* /*
The following where condition is applied to avoid displaying revenue metrics The following where condition is applied to avoid displaying revenue metrics
in the MTD for the current month and the previous month. The main reason is in the MTD for the current month and the previous month. The main reason is

View file

@ -307,7 +307,7 @@ models:
tests: tests:
- not_null - not_null
- name: mtd_aggregated_metrics - name: mtd_agg_metrics
description: | description: |
This model aggregates the historic information of our business by providing This model aggregates the historic information of our business by providing
different metrics computed at global and dimension level. different metrics computed at global and dimension level.
@ -447,19 +447,19 @@ models:
positive impact for Superhog, otherwise is equal to relative_increment. positive impact for Superhog, otherwise is equal to relative_increment.
This value is specially created for formatting in PBI This value is specially created for formatting in PBI
- name: monthly_aggregated_metrics_history_by_deal - name: monthly_agg_metrics_history_by_deal
description: | description: |
This model aggregates the monthly historic information regarding the different metrics computed This model aggregates the monthly historic information regarding the different metrics computed
at deal level. The primary source of data is the `int_monthly_XXXXX_history_by_deal` at deal level. The primary source of data is the `int_monthly_XXXXX_history_by_deal`
model which contain the raw metrics data per source. model which contain the raw metrics data per source.
This table is used to provide "By Deal" metrics in the Business Overview reporting. This table is used to provide "By Deal" metrics in the Business Overview reporting.
Unlike the mtd_aggregated_metrics, this model does not abstract each metric, since Unlike the mtd_agg_metrics, this model does not abstract each metric, since
no comparison versus last year is performed. In short, it just gathers the information stored no comparison versus last year is performed. In short, it just gathers the information stored
in the abovementioned models. in the abovementioned models.
To keep in mind: aggregating the information of this model will not necessarily result into To keep in mind: aggregating the information of this model will not necessarily result into
the int_mtd_aggregated metrics because 1) the mtd version contains more computing dates the int_mtd_agg_metrics because 1) the mtd version contains more computing dates
than the by deal version, the latest being a subset of the first, and 2) the deal based model than the by deal version, the latest being a subset of the first, and 2) the deal based model
enforces that a booking/guest journey/listing/etc has a host with a deal assigned, which is enforces that a booking/guest journey/listing/etc has a host with a deal assigned, which is
not necessarily the case. not necessarily the case.