Commit wip test
This commit is contained in:
parent
8c3a32d62e
commit
c902ae2dff
4 changed files with 92 additions and 0 deletions
|
|
@ -16,12 +16,39 @@ with
|
||||||
),
|
),
|
||||||
int_kpis__agg_monthly_new_dash_chargeable_services as (
|
int_kpis__agg_monthly_new_dash_chargeable_services as (
|
||||||
select * from {{ ref("int_kpis__agg_monthly_new_dash_chargeable_services") }}
|
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
|
select
|
||||||
coalesce(created.date, chargeable.date) as date,
|
coalesce(created.date, chargeable.date) as date,
|
||||||
'daily' as time_granularity,
|
'daily' as time_granularity,
|
||||||
coalesce(created.dimension, chargeable.dimension) as dimension,
|
coalesce(created.dimension, chargeable.dimension) as dimension,
|
||||||
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
|
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.created_services, 0) as created_services,
|
||||||
coalesce(
|
coalesce(
|
||||||
created.booking_with_created_services_count, 0
|
created.booking_with_created_services_count, 0
|
||||||
|
|
@ -38,12 +65,28 @@ full outer join
|
||||||
on created.date = chargeable.date
|
on created.date = chargeable.date
|
||||||
and created.dimension = chargeable.dimension
|
and created.dimension = chargeable.dimension
|
||||||
and created.dimension_value = chargeable.dimension_value
|
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
|
union all
|
||||||
select
|
select
|
||||||
coalesce(created.end_date, chargeable.end_date) as date,
|
coalesce(created.end_date, chargeable.end_date) as date,
|
||||||
'weekly' as time_granularity,
|
'weekly' as time_granularity,
|
||||||
coalesce(created.dimension, chargeable.dimension) as dimension,
|
coalesce(created.dimension, chargeable.dimension) as dimension,
|
||||||
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
|
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.created_services, 0) as created_services,
|
||||||
coalesce(
|
coalesce(
|
||||||
created.booking_with_created_services_count, 0
|
created.booking_with_created_services_count, 0
|
||||||
|
|
@ -60,12 +103,28 @@ full outer join
|
||||||
on created.end_date = chargeable.end_date
|
on created.end_date = chargeable.end_date
|
||||||
and created.dimension = chargeable.dimension
|
and created.dimension = chargeable.dimension
|
||||||
and created.dimension_value = chargeable.dimension_value
|
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
|
union all
|
||||||
select
|
select
|
||||||
coalesce(created.end_date, chargeable.end_date) as date,
|
coalesce(created.end_date, chargeable.end_date) as date,
|
||||||
'monthly' as time_granularity,
|
'monthly' as time_granularity,
|
||||||
coalesce(created.dimension, chargeable.dimension) as dimension,
|
coalesce(created.dimension, chargeable.dimension) as dimension,
|
||||||
coalesce(created.dimension_value, chargeable.dimension_value) as dimension_value,
|
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.created_services, 0) as created_services,
|
||||||
coalesce(
|
coalesce(
|
||||||
created.booking_with_created_services_count, 0
|
created.booking_with_created_services_count, 0
|
||||||
|
|
@ -82,3 +141,13 @@ full outer join
|
||||||
on created.end_date = chargeable.end_date
|
on created.end_date = chargeable.end_date
|
||||||
and created.dimension = chargeable.dimension
|
and created.dimension = chargeable.dimension
|
||||||
and created.dimension_value = chargeable.dimension_value
|
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
|
||||||
|
|
|
||||||
|
|
@ -6711,6 +6711,16 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- 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
|
- name: created_services
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ select
|
||||||
{{ capitalise_and_remove_underscores("dimension") }} as dimension,
|
{{ capitalise_and_remove_underscores("dimension") }} as dimension,
|
||||||
dimension_value as dimension_value,
|
dimension_value as dimension_value,
|
||||||
created_services as created_services,
|
created_services as created_services,
|
||||||
|
deal_with_offered_service_count as deal_with_offered_service_count,
|
||||||
|
accommodation_with_offered_service_count
|
||||||
|
as accommodation_with_offered_service_count,
|
||||||
booking_with_created_services_count as booking_with_created_services_count,
|
booking_with_created_services_count as booking_with_created_services_count,
|
||||||
total_chargeable_services as total_chargeable_services,
|
total_chargeable_services as total_chargeable_services,
|
||||||
total_chargeable_amount_in_gbp as total_chargeable_amount_in_gbp,
|
total_chargeable_amount_in_gbp as total_chargeable_amount_in_gbp,
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,16 @@ models:
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
The created services for a given time granularity, date or dates range,
|
The created services for a given time granularity, date or dates range,
|
||||||
|
|
||||||
|
- 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.
|
||||||
dimension and value.
|
dimension and value.
|
||||||
|
|
||||||
- name: booking_with_created_services_count
|
- name: booking_with_created_services_count
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue