From 55539ab2c91c23cc980cfab9fd6dab9a084ed45e Mon Sep 17 00:00:00 2001 From: Joaquin Ossa Date: Tue, 7 Jan 2025 11:47:14 +0100 Subject: [PATCH] ordered names to select oldest one created --- .../cross/int_deals_consolidation.sql | 8 +++++--- models/reporting/exposures.yml | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/models/intermediate/cross/int_deals_consolidation.sql b/models/intermediate/cross/int_deals_consolidation.sql index 48ba62e..874aaad 100644 --- a/models/intermediate/cross/int_deals_consolidation.sql +++ b/models/intermediate/cross/int_deals_consolidation.sql @@ -16,7 +16,7 @@ with u.company_name as core_company_name, c.core_company_name_count, row_number() over ( - partition by u.id_deal order by u.company_name + partition by u.id_deal order by u.created_at_utc ) as row_num from int_core__unified_user u left join core_deal_counts c on u.id_deal = c.id_deal @@ -40,7 +40,9 @@ with h.id_deal, h.deal_name as hubspot_deal_name, c.hubspot_deal_name_count, - row_number() over (partition by h.id_deal order by h.deal_name) as row_num + row_number() over ( + partition by h.id_deal order by h.created_at_utc + ) as row_num from int_hubspot__deal h left join hubspot_deal_counts c on h.id_deal = c.id_deal where h.id_deal is not null @@ -64,7 +66,7 @@ with x.contact_name as xero_contact_name, c.xero_contact_name_count, row_number() over ( - partition by x.id_deal order by x.contact_name + partition by x.id_deal order by x.updated_at_utc ) as row_num from int_xero__contacts x left join xero_contact_counts c on x.id_deal = c.id_deal diff --git a/models/reporting/exposures.yml b/models/reporting/exposures.yml index 509cd3a..ab1298a 100644 --- a/models/reporting/exposures.yml +++ b/models/reporting/exposures.yml @@ -352,3 +352,21 @@ exposures: owner: name: Pablo Martin email: pablo.martin@superhog.com + + - name: deals_consolidation_report + label: Deals Consolidation + type: dashboard + maturity: medium + url: to be filled + description: | + A PBI report that shows all deals id from Superhog backend (Core), HubSpot + and Xero into a table. + It contains the deal's name (if it exists) and the number of different names + it has in each source. + + depends_on: + - ref('deals_consolidation') + + owner: + name: Joaquin Ossa + email: joaquin.ossa@superhog.com