diff --git a/macros/business_kpis_configuration.sql b/macros/business_kpis_configuration.sql index 3b3f797..11e4aaf 100644 --- a/macros/business_kpis_configuration.sql +++ b/macros/business_kpis_configuration.sql @@ -171,34 +171,13 @@ Provides a general assignement for the Dimensions available for each KPI ] %} {% endif %} - {% if entity_name == "NEW_DASH_CREATED_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_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" %} + {% if entity_name in [ + "NEW_DASH_CREATED_SERVICES", + "NEW_DASH_CHARGEABLE_SERVICES", + "NEW_DASH_ACCOMMODATION_OFFERED_SERVICES", + "NEW_DASH_CREATED_BOOKINGS", + "NEW_DASH_DEALS_OFFERED_SERVICES", + ] %} {% set additional_dimensions = additional_dimensions + [ dim_has_upgraded_service(), dim_new_dash_version(), diff --git a/models/intermediate/kpis/int_kpis__agg_daily_new_dash_created_bookings.sql b/models/intermediate/kpis/int_kpis__agg_daily_new_dash_created_bookings.sql new file mode 100644 index 0000000..77dd889 --- /dev/null +++ b/models/intermediate/kpis/int_kpis__agg_daily_new_dash_created_bookings.sql @@ -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 %} diff --git a/models/intermediate/kpis/int_kpis__agg_monthly_new_dash_created_bookings.sql b/models/intermediate/kpis/int_kpis__agg_monthly_new_dash_created_bookings.sql new file mode 100644 index 0000000..185c844 --- /dev/null +++ b/models/intermediate/kpis/int_kpis__agg_monthly_new_dash_created_bookings.sql @@ -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 %} diff --git a/models/intermediate/kpis/int_kpis__agg_weekly_new_dash_created_bookings.sql b/models/intermediate/kpis/int_kpis__agg_weekly_new_dash_created_bookings.sql new file mode 100644 index 0000000..5bf664a --- /dev/null +++ b/models/intermediate/kpis/int_kpis__agg_weekly_new_dash_created_bookings.sql @@ -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 %} diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql new file mode 100644 index 0000000..9d332d7 --- /dev/null +++ b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql @@ -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 diff --git a/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql b/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql index 701d6c0..88b174f 100644 --- a/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql +++ b/models/intermediate/kpis/int_kpis__product_new_dash_agg_metrics.sql @@ -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 - 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") }}), + all_dates as ( select distinct c.date, c.dimension, c.dimension_value, d.is_end_of_week, d.is_end_of_month from ( 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 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 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 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 left join int_kpis__dimension_dates d on c.date = d.date ) -select - d.date, - 'daily' 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_daily_new_dash_created_services created - on d.date = created.date - and d.dimension = created.dimension - and d.dimension_value = created.dimension_value -left join - 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 + +{% for time_granularity in ["daily", "weekly", "monthly"] %} + select + d.date, + '{{ time_granularity }}' as time_granularity, + d.dimension, + d.dimension_value + {% for agg_model in agg_models if time_granularity in agg_model["name"] %} + {% for metric in agg_model["metrics"] %} + , coalesce({{ ref(agg_model["name"]) }}.{{ metric }}, 0) as {{ metric }} + {% endfor %} + {% endfor %} + from all_dates d + {% for agg_model in agg_models if time_granularity in agg_model["name"] %} + left join + {{ ref(agg_model["name"]) }} + on d.date = {{ ref(agg_model["name"]) }}.{{ agg_model["date_field"] }} + and d.dimension = {{ ref(agg_model["name"]) }}.dimension + and d.dimension_value = {{ ref(agg_model["name"]) }}.dimension_value + {% endfor %} + {% if time_granularity == "weekly" %} where d.is_end_of_week + {% elif time_granularity == "monthly" %} where d.is_end_of_month + {% endif %} + + {% if not loop.last %} + union all + {% endif %} +{% endfor %} diff --git a/models/intermediate/kpis/schema.yml b/models/intermediate/kpis/schema.yml index f96fd9b..67e4128 100644 --- a/models/intermediate/kpis/schema.yml +++ b/models/intermediate/kpis/schema.yml @@ -6727,14 +6727,11 @@ models: The created services for a given time granularity, date or dates range, dimension and value. - - name: booking_with_created_services_count + - name: created_bookings data_type: bigint description: | - The bookings with created services for a given time granularity, date or - dates range, 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. + The amount of created bookings for a given time granularity, date or dates range, + dimension and value. - name: total_chargeable_services data_type: integer @@ -8346,3 +8343,284 @@ models: description: | The month-to-date Revenue Retained Post-Resolutions in GBP 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. + diff --git a/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql b/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql index 384abd4..bbdb31f 100644 --- a/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql +++ b/models/reporting/kpis/kpis__product_new_dash_agg_metrics.sql @@ -11,7 +11,7 @@ select 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, + created_bookings as created_bookings, total_chargeable_services as total_chargeable_services, total_chargeable_amount_in_gbp as total_chargeable_amount_in_gbp, unique_chargeable_bookings as unique_chargeable_bookings, diff --git a/models/reporting/kpis/schema.yml b/models/reporting/kpis/schema.yml index 0bbe918..79da89d 100644 --- a/models/reporting/kpis/schema.yml +++ b/models/reporting/kpis/schema.yml @@ -327,14 +327,11 @@ models: description: | 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 description: | - The bookings with created services for a given time granularity, date or - dates range, 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. + The amount of created bookings for a given time granularity, date or dates range, + dimension and value. - name: total_chargeable_services data_type: integer