Commit wip test

This commit is contained in:
Joaquin 2025-03-27 14:27:38 +01:00
parent 8c3a32d62e
commit c902ae2dff
4 changed files with 92 additions and 0 deletions

View file

@ -16,12 +16,39 @@ with
),
int_kpis__agg_monthly_new_dash_chargeable_services as (
select * from {{ ref("int_kpis__agg_monthly_new_dash_chargeable_services") }}
),
int_kpis__agg_daily_new_dash_deals_offered_services as (
select * from {{ ref("int_kpis__agg_daily_new_dash_deals_offered_services") }}
),
int_kpis__agg_weekly_new_dash_deals_offered_services as (
select * from {{ ref("int_kpis__agg_weekly_new_dash_deals_offered_services") }}
),
int_kpis__agg_monthly_new_dash_deals_offered_services as (
select * from {{ ref("int_kpis__agg_monthly_new_dash_deals_offered_services") }}
),
int_kpis__agg_daily_new_dash_accommodation_offered_services as (
select *
from {{ ref("int_kpis__agg_daily_new_dash_accommodation_offered_services") }}
),
int_kpis__agg_weekly_new_dash_accommodation_offered_services as (
select *
from {{ ref("int_kpis__agg_weekly_new_dash_accommodation_offered_services") }}
),
int_kpis__agg_monthly_new_dash_accommodation_offered_services as (
select *
from {{ ref("int_kpis__agg_monthly_new_dash_accommodation_offered_services") }}
)
select
coalesce(created.date, chargeable.date) as date,
'daily' as time_granularity,
coalesce(created.dimension, chargeable.dimension) as dimension,
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
coalesce(
deals.deal_with_offered_service_count, 0
) as deal_with_offered_service_count,
coalesce(
accommodation.accommodation_with_offered_service_count, 0
) as accommodation_with_offered_service_count,
coalesce(created.created_services, 0) as created_services,
coalesce(
created.booking_with_created_services_count, 0
@ -38,12 +65,28 @@ full outer join
on created.date = chargeable.date
and created.dimension = chargeable.dimension
and created.dimension_value = chargeable.dimension_value
full outer join
int_kpis__agg_daily_new_dash_deals_offered_services deals
on created.date = deals.date
and created.dimension = deals.dimension
and created.dimension_value = deals.dimension_value
full outer join
int_kpis__agg_daily_new_dash_accommodation_offered_services accommodation
on created.date = accommodation.date
and created.dimension = accommodation.dimension
and created.dimension_value = accommodation.dimension_value
union all
select
coalesce(created.end_date, chargeable.end_date) as date,
'weekly' as time_granularity,
coalesce(created.dimension, chargeable.dimension) as dimension,
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
coalesce(
deals.deal_with_offered_service_count, 0
) as deal_with_offered_service_count,
coalesce(
accommodation.accommodation_with_offered_service_count, 0
) as accommodation_with_offered_service_count,
coalesce(created.created_services, 0) as created_services,
coalesce(
created.booking_with_created_services_count, 0
@ -60,12 +103,28 @@ full outer join
on created.end_date = chargeable.end_date
and created.dimension = chargeable.dimension
and created.dimension_value = chargeable.dimension_value
full outer join
int_kpis__agg_weekly_new_dash_deals_offered_services deals
on created.end_date = deals.end_date
and created.dimension = deals.dimension
and created.dimension_value = deals.dimension_value
full outer join
int_kpis__agg_weekly_new_dash_accommodation_offered_services accommodation
on created.end_date = accommodation.end_date
and created.dimension = accommodation.dimension
and created.dimension_value = accommodation.dimension_value
union all
select
coalesce(created.end_date, chargeable.end_date) as date,
'monthly' as time_granularity,
coalesce(created.dimension, chargeable.dimension) as dimension,
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
coalesce(
deals.deal_with_offered_service_count, 0
) as deal_with_offered_service_count,
coalesce(
accommodation.accommodation_with_offered_service_count, 0
) as accommodation_with_offered_service_count,
coalesce(created.created_services, 0) as created_services,
coalesce(
created.booking_with_created_services_count, 0
@ -82,3 +141,13 @@ full outer join
on created.end_date = chargeable.end_date
and created.dimension = chargeable.dimension
and created.dimension_value = chargeable.dimension_value
full outer join
int_kpis__agg_monthly_new_dash_deals_offered_services deals
on created.end_date = deals.end_date
and created.dimension = deals.dimension
and created.dimension_value = deals.dimension_value
full outer join
int_kpis__agg_monthly_new_dash_accommodation_offered_services accommodation
on created.end_date = accommodation.end_date
and created.dimension = accommodation.dimension
and created.dimension_value = accommodation.dimension_value

View file

@ -6711,6 +6711,16 @@ models:
data_tests:
- not_null
- name: deal_with_offered_service_count
data_type: bigint
description: |
The count of deals with services offered by a given date, dimension and value.
- name: accommodation_with_offered_service_count
data_type: bigint
description: |
The count of accommodations with services offered by a given date, dimension and value.
- name: created_services
data_type: bigint
description: |