Merged PR 4865: New dash created bookings models
# Description New kpis model for created bookings in new dash. I also correctly updated the joins in `int_kpis__product_new_dash_agg_metrics` # 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.
This commit is contained in:
commit
ced7373fa9
9 changed files with 540 additions and 214 deletions
|
|
@ -171,34 +171,13 @@ Provides a general assignement for the Dimensions available for each KPI
|
||||||
] %}
|
] %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if entity_name == "NEW_DASH_CREATED_SERVICES" %}
|
{% if entity_name in [
|
||||||
{% set additional_dimensions = additional_dimensions + [
|
"NEW_DASH_CREATED_SERVICES",
|
||||||
dim_has_upgraded_service(),
|
"NEW_DASH_CHARGEABLE_SERVICES",
|
||||||
dim_new_dash_version(),
|
"NEW_DASH_ACCOMMODATION_OFFERED_SERVICES",
|
||||||
dim_pricing_service(),
|
"NEW_DASH_CREATED_BOOKINGS",
|
||||||
dim_pricing_business_type(),
|
"NEW_DASH_DEALS_OFFERED_SERVICES",
|
||||||
] %}
|
] %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if entity_name == "NEW_DASH_CHARGEABLE_SERVICES" %}
|
|
||||||
{% set additional_dimensions = additional_dimensions + [
|
|
||||||
dim_has_upgraded_service(),
|
|
||||||
dim_new_dash_version(),
|
|
||||||
dim_pricing_service(),
|
|
||||||
dim_pricing_business_type(),
|
|
||||||
] %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if entity_name == "NEW_DASH_DEALS_OFFERED_SERVICES" %}
|
|
||||||
{% set additional_dimensions = additional_dimensions + [
|
|
||||||
dim_has_upgraded_service(),
|
|
||||||
dim_new_dash_version(),
|
|
||||||
dim_pricing_service(),
|
|
||||||
dim_pricing_business_type(),
|
|
||||||
] %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if entity_name == "NEW_DASH_ACCOMMODATION_OFFERED_SERVICES" %}
|
|
||||||
{% set additional_dimensions = additional_dimensions + [
|
{% set additional_dimensions = additional_dimensions + [
|
||||||
dim_has_upgraded_service(),
|
dim_has_upgraded_service(),
|
||||||
dim_new_dash_version(),
|
dim_new_dash_version(),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{% set dimensions = get_kpi_dimensions_per_model("NEW_DASH_CREATED_BOOKINGS") %}
|
||||||
|
|
||||||
|
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||||
|
|
||||||
|
|
||||||
|
{% for dimension in dimensions %}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
d.date,
|
||||||
|
{{ dimension.dimension }} as dimension,
|
||||||
|
{{ dimension.dimension_value }} as dimension_value,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct cbs.id_booking) as created_bookings
|
||||||
|
from {{ ref("int_kpis__dimension_dates") }} d
|
||||||
|
left join
|
||||||
|
{{ ref("int_kpis__metric_daily_new_dash_created_bookings") }} as cbs
|
||||||
|
on d.date = cbs.date
|
||||||
|
where cbs.id_deal is not null
|
||||||
|
group by 1, 2, 3
|
||||||
|
{% if not loop.last %}
|
||||||
|
union all
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{% set dimensions = get_kpi_dimensions_per_model("NEW_DASH_CREATED_BOOKINGS") %}
|
||||||
|
|
||||||
|
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||||
|
|
||||||
|
|
||||||
|
{% for dimension in dimensions %}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
d.first_day_month as start_date,
|
||||||
|
d.date as end_date,
|
||||||
|
{{ dimension.dimension }} as dimension,
|
||||||
|
{{ dimension.dimension_value }} as dimension_value,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct dcb.id_booking) as created_bookings
|
||||||
|
from {{ ref("int_kpis__dimension_dates") }} d
|
||||||
|
left join
|
||||||
|
{{ ref("int_kpis__metric_daily_new_dash_created_bookings") }} as dcb
|
||||||
|
on dcb.date = d.date
|
||||||
|
where d.is_end_of_month = true and dcb.id_booking is not null
|
||||||
|
group by 1, 2, 3, 4
|
||||||
|
{% if not loop.last %}
|
||||||
|
union all
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{% set dimensions = get_kpi_dimensions_per_model("NEW_DASH_CREATED_BOOKINGS") %}
|
||||||
|
|
||||||
|
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||||
|
|
||||||
|
|
||||||
|
{% for dimension in dimensions %}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
d.first_day_month as start_date,
|
||||||
|
d.date as end_date,
|
||||||
|
{{ dimension.dimension }} as dimension,
|
||||||
|
{{ dimension.dimension_value }} as dimension_value,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct dcb.id_booking) as created_bookings
|
||||||
|
from {{ ref("int_kpis__dimension_dates") }} d
|
||||||
|
left join
|
||||||
|
{{ ref("int_kpis__metric_daily_new_dash_created_bookings") }} as dcb
|
||||||
|
on dcb.date = d.date
|
||||||
|
where d.is_end_of_week = true and dcb.id_booking is not null
|
||||||
|
group by 1, 2, 3, 4
|
||||||
|
{% if not loop.last %}
|
||||||
|
union all
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
{{
|
||||||
|
config(
|
||||||
|
materialized="table",
|
||||||
|
unique_key=[
|
||||||
|
"date",
|
||||||
|
"id_booking",
|
||||||
|
"id_user_product_bundle",
|
||||||
|
"service_name",
|
||||||
|
"service_business_type",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
date(bs.booking_created_date_utc) as date,
|
||||||
|
bs.id_booking,
|
||||||
|
bs.id_user_product_bundle,
|
||||||
|
coalesce(icbsd.service_name) as service_name,
|
||||||
|
coalesce(icbsd.service_business_type, 'UNSET') as service_business_type,
|
||||||
|
-- Dimensions --
|
||||||
|
coalesce(bs.id_deal, 'UNSET') as id_deal,
|
||||||
|
case when icbsd.is_upgraded_service then 'YES' else 'NO' end as is_upgraded_service,
|
||||||
|
coalesce(bs.new_dash_version, 'UNSET') as new_dash_version,
|
||||||
|
coalesce(
|
||||||
|
uh.main_billing_country_iso_3_per_deal, 'UNSET'
|
||||||
|
) as main_billing_country_iso_3_per_deal,
|
||||||
|
coalesce(
|
||||||
|
icmas.active_accommodations_per_deal_segmentation, 'UNSET'
|
||||||
|
) as active_accommodations_per_deal_segmentation
|
||||||
|
from {{ ref("int_core__booking_summary") }} as bs
|
||||||
|
inner join
|
||||||
|
{{ ref("int_core__booking_service_detail") }} as icbsd
|
||||||
|
on bs.id_booking = icbsd.id_booking
|
||||||
|
inner join {{ ref("int_core__user_host") }} as uh on bs.id_user_host = uh.id_user_host
|
||||||
|
left join
|
||||||
|
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas
|
||||||
|
on bs.id_deal = icmas.id_deal
|
||||||
|
and date(icbsd.service_detail_created_at_utc) = icmas.date
|
||||||
|
where
|
||||||
|
bs.is_user_in_new_dash = true
|
||||||
|
and bs.is_missing_id_deal = false
|
||||||
|
and icbsd.service_detail_created_at_utc
|
||||||
|
>= bs.user_in_new_dash_since_timestamp_at_utc
|
||||||
|
|
@ -1,190 +1,148 @@
|
||||||
|
{% set agg_models = [
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_daily_new_dash_created_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["created_services"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_daily_new_dash_chargeable_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": [
|
||||||
|
"total_chargeable_services",
|
||||||
|
"total_chargeable_amount_in_gbp",
|
||||||
|
"unique_chargeable_bookings",
|
||||||
|
"unique_chargeable_listings",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_daily_new_dash_deals_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["deal_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_daily_new_dash_accommodation_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["accommodation_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_daily_new_dash_created_bookings",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["created_bookings"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_weekly_new_dash_created_services",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": ["created_services"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_weekly_new_dash_chargeable_services",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": [
|
||||||
|
"total_chargeable_services",
|
||||||
|
"total_chargeable_amount_in_gbp",
|
||||||
|
"unique_chargeable_bookings",
|
||||||
|
"unique_chargeable_listings",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_weekly_new_dash_deals_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["deal_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_weekly_new_dash_accommodation_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["accommodation_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_weekly_new_dash_created_bookings",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": ["created_bookings"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_monthly_new_dash_created_services",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": ["created_services"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_monthly_new_dash_chargeable_services",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": [
|
||||||
|
"total_chargeable_services",
|
||||||
|
"total_chargeable_amount_in_gbp",
|
||||||
|
"unique_chargeable_bookings",
|
||||||
|
"unique_chargeable_listings",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_monthly_new_dash_deals_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["deal_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_monthly_new_dash_accommodation_offered_services",
|
||||||
|
"date_field": "date",
|
||||||
|
"metrics": ["accommodation_with_offered_service_count"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "int_kpis__agg_monthly_new_dash_created_bookings",
|
||||||
|
"date_field": "end_date",
|
||||||
|
"metrics": ["created_bookings"],
|
||||||
|
},
|
||||||
|
] %}
|
||||||
|
|
||||||
with
|
with
|
||||||
int_kpis__agg_daily_new_dash_created_services as (
|
|
||||||
select * from {{ ref("int_kpis__agg_daily_new_dash_created_services") }}
|
|
||||||
),
|
|
||||||
int_kpis__agg_weekly_new_dash_created_services as (
|
|
||||||
select * from {{ ref("int_kpis__agg_weekly_new_dash_created_services") }}
|
|
||||||
),
|
|
||||||
int_kpis__agg_monthly_new_dash_created_services as (
|
|
||||||
select * from {{ ref("int_kpis__agg_monthly_new_dash_created_services") }}
|
|
||||||
),
|
|
||||||
int_kpis__agg_daily_new_dash_chargeable_services as (
|
|
||||||
select * from {{ ref("int_kpis__agg_daily_new_dash_chargeable_services") }}
|
|
||||||
),
|
|
||||||
int_kpis__agg_weekly_new_dash_chargeable_services as (
|
|
||||||
select * from {{ ref("int_kpis__agg_weekly_new_dash_chargeable_services") }}
|
|
||||||
),
|
|
||||||
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") }}
|
|
||||||
),
|
|
||||||
int_kpis__dimension_dates as (select * from {{ ref("int_kpis__dimension_dates") }}),
|
int_kpis__dimension_dates as (select * from {{ ref("int_kpis__dimension_dates") }}),
|
||||||
|
|
||||||
all_dates as (
|
all_dates as (
|
||||||
select distinct
|
select distinct
|
||||||
c.date, c.dimension, c.dimension_value, d.is_end_of_week, d.is_end_of_month
|
c.date, c.dimension, c.dimension_value, d.is_end_of_week, d.is_end_of_month
|
||||||
from
|
from
|
||||||
(
|
(
|
||||||
select date, dimension, dimension_value
|
select date, dimension, dimension_value
|
||||||
from int_kpis__agg_daily_new_dash_created_services
|
from {{ ref("int_kpis__agg_daily_new_dash_created_services") }}
|
||||||
union all
|
union all
|
||||||
select date, dimension, dimension_value
|
select date, dimension, dimension_value
|
||||||
from int_kpis__agg_daily_new_dash_chargeable_services
|
from {{ ref("int_kpis__agg_daily_new_dash_chargeable_services") }}
|
||||||
union all
|
union all
|
||||||
select date, dimension, dimension_value
|
select date, dimension, dimension_value
|
||||||
from int_kpis__agg_daily_new_dash_deals_offered_services
|
from {{ ref("int_kpis__agg_daily_new_dash_deals_offered_services") }}
|
||||||
union all
|
union all
|
||||||
select date, dimension, dimension_value
|
select date, dimension, dimension_value
|
||||||
from int_kpis__agg_daily_new_dash_accommodation_offered_services
|
from
|
||||||
|
{{
|
||||||
|
ref(
|
||||||
|
"int_kpis__agg_daily_new_dash_accommodation_offered_services"
|
||||||
|
)
|
||||||
|
}}
|
||||||
) c
|
) c
|
||||||
left join int_kpis__dimension_dates d on c.date = d.date
|
left join int_kpis__dimension_dates d on c.date = d.date
|
||||||
)
|
)
|
||||||
select
|
|
||||||
d.date,
|
{% for time_granularity in ["daily", "weekly", "monthly"] %}
|
||||||
'daily' as time_granularity,
|
select
|
||||||
d.dimension,
|
d.date,
|
||||||
d.dimension_value,
|
'{{ time_granularity }}' as time_granularity,
|
||||||
coalesce(
|
d.dimension,
|
||||||
deals.deal_with_offered_service_count, 0
|
d.dimension_value
|
||||||
) as deal_with_offered_service_count,
|
{% for agg_model in agg_models if time_granularity in agg_model["name"] %}
|
||||||
coalesce(
|
{% for metric in agg_model["metrics"] %}
|
||||||
accommodation.accommodation_with_offered_service_count, 0
|
, coalesce({{ ref(agg_model["name"]) }}.{{ metric }}, 0) as {{ metric }}
|
||||||
) as accommodation_with_offered_service_count,
|
{% endfor %}
|
||||||
coalesce(created.created_services, 0) as created_services,
|
{% endfor %}
|
||||||
coalesce(
|
from all_dates d
|
||||||
created.booking_with_created_services_count, 0
|
{% for agg_model in agg_models if time_granularity in agg_model["name"] %}
|
||||||
) as booking_with_created_services_count,
|
left join
|
||||||
coalesce(chargeable.total_chargeable_services, 0) as total_chargeable_services,
|
{{ ref(agg_model["name"]) }}
|
||||||
coalesce(
|
on d.date = {{ ref(agg_model["name"]) }}.{{ agg_model["date_field"] }}
|
||||||
chargeable.total_chargeable_amount_in_gbp, 0
|
and d.dimension = {{ ref(agg_model["name"]) }}.dimension
|
||||||
) as total_chargeable_amount_in_gbp,
|
and d.dimension_value = {{ ref(agg_model["name"]) }}.dimension_value
|
||||||
coalesce(chargeable.unique_chargeable_bookings, 0) as unique_chargeable_bookings,
|
{% endfor %}
|
||||||
coalesce(chargeable.unique_chargeable_listings, 0) as unique_chargeable_listings
|
{% if time_granularity == "weekly" %} where d.is_end_of_week
|
||||||
from all_dates d
|
{% elif time_granularity == "monthly" %} where d.is_end_of_month
|
||||||
left join
|
{% endif %}
|
||||||
int_kpis__agg_daily_new_dash_created_services created
|
|
||||||
on d.date = created.date
|
{% if not loop.last %}
|
||||||
and d.dimension = created.dimension
|
union all
|
||||||
and d.dimension_value = created.dimension_value
|
{% endif %}
|
||||||
left join
|
{% endfor %}
|
||||||
int_kpis__agg_daily_new_dash_chargeable_services chargeable
|
|
||||||
on created.date = chargeable.date
|
|
||||||
and created.dimension = chargeable.dimension
|
|
||||||
and created.dimension_value = chargeable.dimension_value
|
|
||||||
left 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
|
|
||||||
left 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
|
|
||||||
d.date,
|
|
||||||
'weekly' as time_granularity,
|
|
||||||
d.dimension,
|
|
||||||
d.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
|
|
||||||
) as booking_with_created_services_count,
|
|
||||||
coalesce(chargeable.total_chargeable_services, 0) as total_chargeable_services,
|
|
||||||
coalesce(
|
|
||||||
chargeable.total_chargeable_amount_in_gbp, 0
|
|
||||||
) as total_chargeable_amount_in_gbp,
|
|
||||||
coalesce(chargeable.unique_chargeable_bookings, 0) as unique_chargeable_bookings,
|
|
||||||
coalesce(chargeable.unique_chargeable_listings, 0) as unique_chargeable_listings
|
|
||||||
from all_dates d
|
|
||||||
left join
|
|
||||||
int_kpis__agg_weekly_new_dash_created_services created
|
|
||||||
on d.date = created.end_date
|
|
||||||
and d.dimension = created.dimension
|
|
||||||
and d.dimension_value = created.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_weekly_new_dash_chargeable_services chargeable
|
|
||||||
on created.end_date = chargeable.end_date
|
|
||||||
and created.dimension = chargeable.dimension
|
|
||||||
and created.dimension_value = chargeable.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_weekly_new_dash_deals_offered_services deals
|
|
||||||
on created.end_date = deals.date
|
|
||||||
and created.dimension = deals.dimension
|
|
||||||
and created.dimension_value = deals.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_weekly_new_dash_accommodation_offered_services accommodation
|
|
||||||
on created.end_date = accommodation.date
|
|
||||||
and created.dimension = accommodation.dimension
|
|
||||||
and created.dimension_value = accommodation.dimension_value
|
|
||||||
where d.is_end_of_week
|
|
||||||
union all
|
|
||||||
select
|
|
||||||
d.date,
|
|
||||||
'monthly' as time_granularity,
|
|
||||||
d.dimension,
|
|
||||||
d.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
|
|
||||||
) as booking_with_created_services_count,
|
|
||||||
coalesce(chargeable.total_chargeable_services, 0) as total_chargeable_services,
|
|
||||||
coalesce(
|
|
||||||
chargeable.total_chargeable_amount_in_gbp, 0
|
|
||||||
) as total_chargeable_amount_in_gbp,
|
|
||||||
coalesce(chargeable.unique_chargeable_bookings, 0) as unique_chargeable_bookings,
|
|
||||||
coalesce(chargeable.unique_chargeable_listings, 0) as unique_chargeable_listings
|
|
||||||
from all_dates d
|
|
||||||
left join
|
|
||||||
int_kpis__agg_monthly_new_dash_created_services created
|
|
||||||
on d.date = created.end_date
|
|
||||||
and d.dimension = created.dimension
|
|
||||||
and d.dimension_value = created.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_monthly_new_dash_chargeable_services chargeable
|
|
||||||
on created.end_date = chargeable.end_date
|
|
||||||
and created.dimension = chargeable.dimension
|
|
||||||
and created.dimension_value = chargeable.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_monthly_new_dash_deals_offered_services deals
|
|
||||||
on created.end_date = deals.date
|
|
||||||
and created.dimension = deals.dimension
|
|
||||||
and created.dimension_value = deals.dimension_value
|
|
||||||
left join
|
|
||||||
int_kpis__agg_monthly_new_dash_accommodation_offered_services accommodation
|
|
||||||
on created.end_date = accommodation.date
|
|
||||||
and created.dimension = accommodation.dimension
|
|
||||||
and created.dimension_value = accommodation.dimension_value
|
|
||||||
where d.is_end_of_month
|
|
||||||
|
|
|
||||||
|
|
@ -6727,14 +6727,11 @@ models:
|
||||||
The created services for a given time granularity, date or dates range,
|
The created services for a given time granularity, date or dates range,
|
||||||
dimension and value.
|
dimension and value.
|
||||||
|
|
||||||
- name: booking_with_created_services_count
|
- name: created_bookings
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
The bookings with created services for a given time granularity, date or
|
The amount of created bookings for a given time granularity, date or dates range,
|
||||||
dates range, dimension and value.
|
dimension and value.
|
||||||
This is an approximation to booking count since different services can
|
|
||||||
apply to the same booking and these do not need to be created in the same
|
|
||||||
time period. Therefore, it's not an additive metric.
|
|
||||||
|
|
||||||
- name: total_chargeable_services
|
- name: total_chargeable_services
|
||||||
data_type: integer
|
data_type: integer
|
||||||
|
|
@ -8346,3 +8343,284 @@ models:
|
||||||
description: |
|
description: |
|
||||||
The month-to-date Revenue Retained Post-Resolutions in GBP
|
The month-to-date Revenue Retained Post-Resolutions in GBP
|
||||||
for a given date, dimension and value.
|
for a given date, dimension and value.
|
||||||
|
|
||||||
|
- name: int_kpis__metric_daily_new_dash_created_bookings
|
||||||
|
description: |
|
||||||
|
This model computes the Daily Created Bookings with Services at the deepest granularity.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
The unique key corresponds to the deepest granularity of the model,
|
||||||
|
in this case:
|
||||||
|
- date,
|
||||||
|
- id_booking,
|
||||||
|
- id_user_product_bundle,
|
||||||
|
- service_name,
|
||||||
|
- service_business_type
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- date
|
||||||
|
- id_booking
|
||||||
|
- id_user_product_bundle
|
||||||
|
- service_name
|
||||||
|
- service_business_type
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: date
|
||||||
|
data_type: date
|
||||||
|
description: Date of when the Booking was created.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_booking
|
||||||
|
data_type: bigint
|
||||||
|
description: Unique identifier of the Booking.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_user_product_bundle
|
||||||
|
data_type: bigint
|
||||||
|
description: Unique identifier of the User Product Bundle.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: service_name
|
||||||
|
data_type: string
|
||||||
|
description: Name of the created service.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_deal
|
||||||
|
data_type: string
|
||||||
|
description: Unique identifier of an account.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: is_upgraded_service
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Whether the service is an upgraded version of the
|
||||||
|
default. In other words, if it's not Basic Screening.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "YES"
|
||||||
|
- "NO"
|
||||||
|
|
||||||
|
- name: service_business_type
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Identifies the service type (Screening, Deposit Management, Protection
|
||||||
|
or Guest Agreement) according to New Pricing documentation.
|
||||||
|
Cannot be null.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "SCREENING"
|
||||||
|
- "PROTECTION"
|
||||||
|
- "DEPOSIT_MANAGEMENT"
|
||||||
|
- "GUEST_AGREEMENT"
|
||||||
|
- "UNKNOWN"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
|
- name: new_dash_version
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
The version of the New Dash. It corresponds to the
|
||||||
|
release or migration phase from user point of view.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: active_accommodations_per_deal_segmentation
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Segment value based on the number of listings booked in 12 months
|
||||||
|
for a given deal and date.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "0"
|
||||||
|
- "01-05"
|
||||||
|
- "06-20"
|
||||||
|
- "21-60"
|
||||||
|
- "61+"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
|
- name: main_billing_country_iso_3_per_deal
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Main billing country of the host aggregated at Deal level.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: int_kpis__agg_weekly_new_dash_created_bookings
|
||||||
|
description: |
|
||||||
|
This model computes the dimension aggregation for Weekly Created Bookings with Services.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
The primary key of this model is end_date, dimension and dimension_value.
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- end_date
|
||||||
|
- dimension
|
||||||
|
- dimension_value
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: start_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The start date of the time range considered for the metrics in this record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: end_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The end date of the time range considered for the metrics in this record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: dimension
|
||||||
|
data_type: string
|
||||||
|
description: The dimension or granularity of the metrics.
|
||||||
|
data_tests:
|
||||||
|
- assert_dimension_completeness:
|
||||||
|
metric_column_names:
|
||||||
|
- created_bookings
|
||||||
|
where: "dimension in ('by_number_of_listings', 'by_billing_country', 'by_new_dash_version', 'by_deal')"
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- global
|
||||||
|
- by_number_of_listings
|
||||||
|
- by_billing_country
|
||||||
|
- by_deal
|
||||||
|
- by_new_dash_version
|
||||||
|
- by_has_upgraded_service
|
||||||
|
- by_service
|
||||||
|
- by_service_business_type
|
||||||
|
|
||||||
|
- name: dimension_value
|
||||||
|
data_type: string
|
||||||
|
description: The value or segment available for the selected dimension.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description: The weekly created bookings for a given date range, dimension and value.
|
||||||
|
|
||||||
|
- name: int_kpis__agg_monthly_new_dash_created_bookings
|
||||||
|
description: |
|
||||||
|
This model computes the dimension aggregation for Monthly Created Bookings with Services.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
The primary key of this model is end_date, dimension and dimension_value.
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- end_date
|
||||||
|
- dimension
|
||||||
|
- dimension_value
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: start_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The start date of the time range considered for the metrics in this record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: end_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The end date of the time range considered for the metrics in this record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: dimension
|
||||||
|
data_type: string
|
||||||
|
description: The dimension or granularity of the metrics.
|
||||||
|
data_tests:
|
||||||
|
- assert_dimension_completeness:
|
||||||
|
metric_column_names:
|
||||||
|
- created_bookings
|
||||||
|
where: "dimension in ('by_number_of_listings', 'by_billing_country', 'by_new_dash_version', 'by_deal')"
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- global
|
||||||
|
- by_number_of_listings
|
||||||
|
- by_billing_country
|
||||||
|
- by_deal
|
||||||
|
- by_new_dash_version
|
||||||
|
- by_has_upgraded_service
|
||||||
|
- by_service
|
||||||
|
- by_service_business_type
|
||||||
|
|
||||||
|
- name: dimension_value
|
||||||
|
data_type: string
|
||||||
|
description: The value or segment available for the selected dimension.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description: The monthly created bookings for a given date range, dimension and value.
|
||||||
|
|
||||||
|
- name: int_kpis__agg_daily_new_dash_created_bookings
|
||||||
|
description: |
|
||||||
|
This model computes the dimension aggregation for Daily Created Bookings with Services.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
The primary key of this model is date, dimension and dimension_value.
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- date
|
||||||
|
- dimension
|
||||||
|
- dimension_value
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The daily date acting as time range for the metrics in this record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: dimension
|
||||||
|
data_type: string
|
||||||
|
description: The dimension or granularity of the metrics.
|
||||||
|
data_tests:
|
||||||
|
- assert_dimension_completeness:
|
||||||
|
metric_column_names:
|
||||||
|
- created_bookings
|
||||||
|
where: "dimension in ('by_number_of_listings', 'by_billing_country', 'by_new_dash_version', 'by_deal')"
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- global
|
||||||
|
- by_number_of_listings
|
||||||
|
- by_billing_country
|
||||||
|
- by_deal
|
||||||
|
- by_new_dash_version
|
||||||
|
- by_has_upgraded_service
|
||||||
|
- by_service
|
||||||
|
- by_service_business_type
|
||||||
|
|
||||||
|
- name: dimension_value
|
||||||
|
data_type: string
|
||||||
|
description: The value or segment available for the selected dimension.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description: The daily created bookings for a given date, dimension and value.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ select
|
||||||
deal_with_offered_service_count as deal_with_offered_service_count,
|
deal_with_offered_service_count as deal_with_offered_service_count,
|
||||||
accommodation_with_offered_service_count
|
accommodation_with_offered_service_count
|
||||||
as accommodation_with_offered_service_count,
|
as accommodation_with_offered_service_count,
|
||||||
booking_with_created_services_count as booking_with_created_services_count,
|
created_bookings as created_bookings,
|
||||||
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,
|
||||||
unique_chargeable_bookings as unique_chargeable_bookings,
|
unique_chargeable_bookings as unique_chargeable_bookings,
|
||||||
|
|
|
||||||
|
|
@ -327,14 +327,11 @@ models:
|
||||||
description: |
|
description: |
|
||||||
The count of accommodations with services offered by a given date, dimension and value.
|
The count of accommodations with services offered by a given date, dimension and value.
|
||||||
|
|
||||||
- name: booking_with_created_services_count
|
- name: created_bookings
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
The bookings with created services for a given time granularity, date or
|
The amount of created bookings for a given time granularity, date or dates range,
|
||||||
dates range, dimension and value.
|
dimension and value.
|
||||||
This is an approximation to booking count since different services can
|
|
||||||
apply to the same booking and these do not need to be created in the same
|
|
||||||
time period. Therefore, it's not an additive metric.
|
|
||||||
|
|
||||||
- name: total_chargeable_services
|
- name: total_chargeable_services
|
||||||
data_type: integer
|
data_type: integer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue