ordered names to select oldest one created

This commit is contained in:
Joaquin Ossa 2025-01-07 11:47:14 +01:00
parent f2abd16a44
commit 55539ab2c9
2 changed files with 23 additions and 3 deletions

View file

@ -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

View file

@ -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