data-dwh-dbt-project/models/reporting
Oriol Roqué Paniagua 5928a198b6 Merged PR 4734: Bugfix - Ensures accounts cannot be duplicated in Xero sales monthly trends
# Description

This fixes the duplication error when the same deal has more than one contact. Impact was not massive, it just affected because of the Home to Host account and this has happened during the past week. There were other cases that contained duplicates but these were not invoiced so it didn't affect the total sum.

Changes:
* Contacts now has a boolean field indicating if a deal exists.
* Contacts now has a boolean field indicating if that contact has a deal informed and it's the last updated one. This is opinionated - it could have been done with creation, for instance.
* Sales monthly trends forces the last updated contact to be true.
* Improved robustness by adding tests.

Note that modifying the logic in intermediate on `int_xero__sales_monthly_trends` by changing `id_deal` per `id_contact` would not have worked - we need to do this compute by deal to ensure that any invoicing is reported MoM and YTD.

# 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.
- [X] I have checked for DRY opportunities with other models and docs.
- [X] 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: #28576
2025-03-19 08:19:20 +00:00
..
athena change "tests:" to "data_tests:" 2025-01-13 16:00:35 +01:00
check_in_hero cih monthly fee to reporting 2025-01-21 12:37:50 +01:00
core Merged PR 4687: Bugfix - Removal of SH fields that no longer exist 2025-03-13 12:25:13 +00:00
edeposit change "tests:" to "data_tests:" 2025-01-13 16:00:35 +01:00
general Merged PR 4727: Bookings fees are now Old Dashboard Booking Fees in Main KPIs 2025-03-18 14:55:32 +00:00
kpis change "tests:" to "data_tests:" 2025-01-13 16:00:35 +01:00
resolutions Calculator changes 2025-02-28 12:19:24 +01:00
screen_and_protect Updated tests on S&P fees 2025-02-23 16:14:42 +01:00
xero Merged PR 4734: Bugfix - Ensures accounts cannot be duplicated in Xero sales monthly trends 2025-03-19 08:19:20 +00:00
exposures.yml Updated exposures 2025-03-10 10:57:21 +01:00