diff --git a/macros/business_kpis_configuration.sql b/macros/business_kpis_configuration.sql index 596b454..e05a6ed 100644 --- a/macros/business_kpis_configuration.sql +++ b/macros/business_kpis_configuration.sql @@ -65,9 +65,6 @@ Please note that strings should be encoded with " ' your_value_here ' ", {% macro dim_has_id_check() %} {{ return({"dimension": "'by_has_id_check'", "dimension_value": "has_id_check"}) }} {% endmacro %} -{% macro dim_host() %} - {{ return({"dimension": "'by_host'", "dimension_value": "id_user_host"}) }} -{% endmacro %} {% macro dim_has_upgraded_service() %} {{ return( @@ -143,7 +140,6 @@ Provides a general assignement for the Dimensions available for each KPI {% if entity_name == "NEW_DASH_CREATED_SERVICES" %} {% set additional_dimensions = additional_dimensions + [ - dim_host(), dim_has_upgraded_service(), dim_new_dash_version(), dim_pricing_service(), diff --git a/models/intermediate/core/int_core__user_host.sql b/models/intermediate/core/int_core__user_host.sql index 5654680..031897d 100644 --- a/models/intermediate/core/int_core__user_host.sql +++ b/models/intermediate/core/int_core__user_host.sql @@ -49,6 +49,7 @@ select uu.joined_date_utc, uu.created_date_utc, uu.updated_date_utc, + case when uu.id_deal is null then true else false end as is_missing_id_deal, case when ndu.id_user_host is not null then true else false end as is_user_in_new_dash, diff --git a/models/intermediate/core/int_core__user_product_bundle.sql b/models/intermediate/core/int_core__user_product_bundle.sql index 6373ec5..061e439 100644 --- a/models/intermediate/core/int_core__user_product_bundle.sql +++ b/models/intermediate/core/int_core__user_product_bundle.sql @@ -44,7 +44,7 @@ from stg_core__user_product_bundle upb /* There are many not migrated users that have product bundles. Since users are not migrated, these bundles cannot be active. -In order to avoid potential upstream problems, it is enforced +In order to avoid potential downstream problems, it is enforced that product bundles need to be from users that have been already migrated. */ @@ -52,4 +52,5 @@ inner join int_core__user_host uh on upb.id_user = uh.id_user_host and uh.is_user_in_new_dash = true + and uh.is_missing_id_deal = false left join stg_core__protection_plan pp on upb.id_protection_plan = pp.id_protection_plan diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index 0f21906..b7460b5 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -1850,6 +1850,11 @@ models: description: | Date of the last time the information of the Host was updated in our systems. + - name: is_missing_id_deal + data_type: boolean + description: | + Flag to identify if a user is missing the id_deal (true) or + not (false). - name: is_user_in_new_dash data_type: boolean description: | diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql index 89f339a..5bd16b5 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql @@ -5,7 +5,6 @@ select date(icbsd.service_detail_created_at_utc) as date, coalesce(icbsd.service_name) as service_name, -- Dimensions -- - coalesce(icbs.id_user_host, 'UNSET') as id_user_host, coalesce(icbs.id_deal, 'UNSET') as id_deal, case when icbsd.is_upgraded_service then 'YES' else 'NO' end as is_upgraded_service, coalesce(icbs.new_dash_version, 'UNSET') as new_dash_version, @@ -28,6 +27,7 @@ left join and date(icbsd.service_detail_created_at_utc) = icmas.date where icbs.is_user_in_new_dash = true + and icbs.is_missing_id_deal = false and icbsd.service_detail_created_at_utc >= icbs.user_in_new_dash_since_timestamp_at_utc -group by 1, 2, 3, 4, 5, 6, 7, 8, 9 +group by 1, 2, 3, 4, 5, 6, 7, 8 diff --git a/models/intermediate/kpis/int_kpis__metric_monthly_new_dash_created_services.sql b/models/intermediate/kpis/int_kpis__metric_monthly_new_dash_created_services.sql index c09cb26..e1a5cbd 100644 --- a/models/intermediate/kpis/int_kpis__metric_monthly_new_dash_created_services.sql +++ b/models/intermediate/kpis/int_kpis__metric_monthly_new_dash_created_services.sql @@ -4,7 +4,6 @@ unique_key=[ "end_date", "service_name", - "id_user_host", "new_dash_version", "active_accommodations_per_deal_segmentation", ], @@ -16,7 +15,6 @@ select d.first_day_month as start_date, d.date as end_date, cs.service_name, - cs.id_user_host, cs.active_accommodations_per_deal_segmentation, -- Dimensions -- cs.new_dash_version, @@ -31,4 +29,4 @@ left join {{ ref("int_kpis__metric_daily_new_dash_created_services") }} cs on date_trunc('month', cs.date)::date = d.first_day_month where d.is_end_of_month = true and cs.id_deal is not null -group by 1, 2, 3, 4, 5, 6, 7, 8, 9 +group by 1, 2, 3, 4, 5, 6, 7, 8 diff --git a/models/intermediate/kpis/int_kpis__metric_weekly_new_dash_created_services.sql b/models/intermediate/kpis/int_kpis__metric_weekly_new_dash_created_services.sql index bb8bcaa..d6d601f 100644 --- a/models/intermediate/kpis/int_kpis__metric_weekly_new_dash_created_services.sql +++ b/models/intermediate/kpis/int_kpis__metric_weekly_new_dash_created_services.sql @@ -4,7 +4,6 @@ unique_key=[ "end_date", "service_name", - "id_user_host", "new_dash_version", "active_accommodations_per_deal_segmentation", ], @@ -16,7 +15,6 @@ select d.first_day_week as start_date, d.date as end_date, cs.service_name, - cs.id_user_host, cs.active_accommodations_per_deal_segmentation, -- Dimensions -- cs.new_dash_version, @@ -31,4 +29,4 @@ left join {{ ref("int_kpis__metric_daily_new_dash_created_services") }} cs on date_trunc('week', cs.date)::date = d.first_day_week where d.is_end_of_week = true and cs.id_deal is not null -group by 1, 2, 3, 4, 5, 6, 7, 8, 9 +group by 1, 2, 3, 4, 5, 6, 7, 8 diff --git a/models/intermediate/kpis/schema.yml b/models/intermediate/kpis/schema.yml index 57944d4..85cdf31 100644 --- a/models/intermediate/kpis/schema.yml +++ b/models/intermediate/kpis/schema.yml @@ -5324,12 +5324,6 @@ models: tests: - not_null - - name: id_user_host - data_type: string - description: Unique identifier of the user that acts as Host. - tests: - - not_null - - name: id_deal data_type: string description: Unique identifier of an account. @@ -5397,7 +5391,7 @@ models: The unique key corresponds to: - end_date, - service_name, - - id_user_host, + - id_deal, - active_accommodations_per_deal_segmentation. tests: @@ -5405,7 +5399,7 @@ models: combination_of_columns: - end_date - service_name - - id_user_host + - id_deal - active_accommodations_per_deal_segmentation columns: @@ -5429,12 +5423,6 @@ models: tests: - not_null - - name: id_user_host - data_type: string - description: Unique identifier of the user that acts as Host. - tests: - - not_null - - name: id_deal data_type: string description: Unique identifier of an account. @@ -5510,7 +5498,7 @@ models: The unique key corresponds to: - end_date, - service_name, - - id_user_host, + - id_deal, - active_accommodations_per_deal_segmentation. tests: @@ -5518,7 +5506,7 @@ models: combination_of_columns: - end_date - service_name - - id_user_host + - id_deal - active_accommodations_per_deal_segmentation columns: @@ -5542,12 +5530,6 @@ models: tests: - not_null - - name: id_user_host - data_type: string - description: Unique identifier of the user that acts as Host. - tests: - - not_null - - name: id_deal data_type: string description: Unique identifier of an account. @@ -5655,7 +5637,6 @@ models: - by_new_dash_version - by_has_upgraded_service - by_service - - by_host - name: dimension_value data_type: string @@ -5778,7 +5759,6 @@ models: - by_new_dash_version - by_has_upgraded_service - by_service - - by_host - name: dimension_value data_type: string @@ -5844,7 +5824,6 @@ models: - by_new_dash_version - by_has_upgraded_service - by_service - - by_host - name: dimension_value data_type: string diff --git a/models/reporting/kpis/schema.yml b/models/reporting/kpis/schema.yml index d49f8dd..9f337bc 100644 --- a/models/reporting/kpis/schema.yml +++ b/models/reporting/kpis/schema.yml @@ -250,7 +250,6 @@ models: - "By New Dash Version" - "By Has Upgraded Service" - "By Service" - - "By Host" - name: dimension_value data_type: string