2024-11-05 16:57:23 +00:00
|
|
|
{{
|
|
|
|
|
config(
|
|
|
|
|
materialized="view",
|
|
|
|
|
unique_key=[
|
|
|
|
|
"end_date",
|
|
|
|
|
"id_deal",
|
|
|
|
|
"active_accommodations_per_deal_segmentation",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
select
|
|
|
|
|
-- Unique Key --
|
|
|
|
|
d.first_day_month as start_date,
|
|
|
|
|
d.date as end_date,
|
|
|
|
|
ir.id_deal,
|
|
|
|
|
ir.active_accommodations_per_deal_segmentation,
|
|
|
|
|
-- Dimensions --
|
|
|
|
|
ir.main_billing_country_iso_3_per_deal,
|
|
|
|
|
-- Metrics --
|
2025-01-20 14:18:05 +00:00
|
|
|
sum(
|
|
|
|
|
ir.xero_basic_protection_net_fees_in_gbp
|
|
|
|
|
) as xero_basic_protection_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_waiver_pro_net_fees_in_gbp) as xero_waiver_pro_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_id_verification_net_fees_in_gbp
|
|
|
|
|
) as xero_id_verification_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_protection_plus_net_fees_in_gbp
|
|
|
|
|
) as xero_protection_plus_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_screening_plus_net_fees_in_gbp) as xero_screening_plus_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_sex_offenders_check_net_fees_in_gbp
|
|
|
|
|
) as xero_sex_offenders_check_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_protection_pro_net_fees_in_gbp) as xero_protection_pro_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_basic_screening_net_fees_in_gbp
|
|
|
|
|
) as xero_basic_screening_net_fees_in_gbp,
|
2024-11-05 16:57:23 +00:00
|
|
|
sum(ir.xero_booking_net_fees_in_gbp) as xero_booking_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_listing_net_fees_in_gbp) as xero_listing_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_verification_net_fees_in_gbp) as xero_verification_net_fees_in_gbp,
|
|
|
|
|
sum(ir.xero_operator_net_fees_in_gbp) as xero_operator_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_waiver_paid_back_to_host_in_gbp
|
|
|
|
|
) as xero_waiver_paid_back_to_host_in_gbp,
|
|
|
|
|
sum(ir.xero_e_deposit_net_fees_in_gbp) as xero_e_deposit_net_fees_in_gbp,
|
2025-01-20 14:18:05 +00:00
|
|
|
sum(ir.xero_athena_net_fees_in_gbp) as xero_athena_net_fees_in_gbp,
|
2024-11-05 16:57:23 +00:00
|
|
|
sum(ir.xero_guesty_net_fees_in_gbp) as xero_guesty_net_fees_in_gbp,
|
2025-01-20 14:18:05 +00:00
|
|
|
sum(ir.xero_apis_net_fees_in_gbp) as xero_apis_net_fees_in_gbp,
|
|
|
|
|
sum(
|
|
|
|
|
ir.xero_guesty_resolutions_net_fees_in_gbp
|
|
|
|
|
) as xero_guesty_resolutions_net_fees_in_gbp
|
2024-11-05 16:57:23 +00:00
|
|
|
|
|
|
|
|
from {{ ref("int_kpis__dimension_dates") }} d
|
|
|
|
|
left join
|
|
|
|
|
{{ ref("int_kpis__metric_daily_invoiced_revenue") }} ir
|
|
|
|
|
on date_trunc('month', ir.date)::date = d.first_day_month
|
|
|
|
|
where d.is_end_of_month = true and ir.id_deal is not null
|
|
|
|
|
group by 1, 2, 3, 4, 5
|