Merged PR 5256: Reporting version of New Dash Onboarding
# Description Reporting version of New Dash Onboarding It also adds a missing description of a field. It also adapts the logic for Hubspot Onboarding Owner, after a discussion with Alex. It still does not cover 100% of the cases but he's investigating the rest. # 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. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #30249
This commit is contained in:
parent
7b6f0d13f6
commit
56aeb701cd
5 changed files with 439 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{% set id_deal_pipelines_excluded = "('15380854')" %}
|
||||
{% set generic_account_manager_names = "('Host Services')" %}
|
||||
{% set generic_account_manager_names = "('HOST SERVICES')" %}
|
||||
{% set guardhog_customer_conversion_source = "('GUARDHOG CUSTOMER CONVERSION')" %}
|
||||
|
||||
with
|
||||
stg_hubspot__deals as (select * from {{ ref("stg_hubspot__deals") }}),
|
||||
|
|
@ -20,13 +21,29 @@ select
|
|||
d.live_date_utc,
|
||||
d.cancellation_date_utc,
|
||||
d.account_manager,
|
||||
-- Following logic discussed with Alex A. on 2025-05-19 to determine the
|
||||
-- onboarding owner
|
||||
case
|
||||
when d.onboarding_owner is not null
|
||||
then onboarding_owner
|
||||
when
|
||||
d.onboarding_owner is null
|
||||
and d.account_manager in {{ generic_account_manager_names }}
|
||||
-- 1. If the cloned onboarding owner is not null, use that. This should reflect
|
||||
-- most of the cases.
|
||||
when d.onboarding_owner__cloned_ is not null
|
||||
then d.onboarding_owner__cloned_
|
||||
-- 2. If the cloned onboarding owner is null and the onboarding owner is not
|
||||
-- null, use the second. It should cover few exceptional cases.
|
||||
when d.onboarding_owner__cloned_ is null and d.onboarding_owner is not null
|
||||
then d.onboarding_owner
|
||||
-- 3. If the deal is a conversion from Guardhog to Truvi, the onboarding owner
|
||||
-- should always be the HubSpot account owner.
|
||||
when upper(d.deal_source) in {{ guardhog_customer_conversion_source }}
|
||||
then hao.hubspot_account_owner
|
||||
-- 4. If the onboarding owner is null and the account manager is in the generic
|
||||
-- account manager names, use the HubSpot account owner. This is because is
|
||||
-- actually a Sales person that handles the onboarding.
|
||||
when
|
||||
d.onboarding_owner__cloned_ is null
|
||||
and upper(d.account_manager) in {{ generic_account_manager_names }}
|
||||
then hao.hubspot_account_owner
|
||||
-- For all other cases, set the onboarding owner to null.
|
||||
else null
|
||||
end as onboarding_owner,
|
||||
dp.deal_pipeline_name as deal_pipeline,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue