Merged PR 2232: KPI refactor - 1st step, bookings
First step on refactor of kpis: - Remove relative incremental vs. previous year computation from the source model (`mtd_booking_metrics`, in this case) - Aggregate the source mtd global metrics models into a single model: `int_mtd_vs_previous_year_metrics` (to enable multi-source weighted metric computation) and compute previous year value and relative increment. Now this logic is encapsulated into a macro `calculate_safe_relative_increment`, easing readability and providing a bit more robustness. - End-to-end continuity to not break the existing dashboard display in `int_core__mtd_aggregated_metrics` This is a substep of the global change. All info can be found in the documentation [here](https://www.notion.so/knowyourguest-superhog/Refactoring-Business-KPIs-5deb6aadddb34884ae90339402ac16e3) Related work items: #18202
This commit is contained in:
parent
62ad19ea9e
commit
409ac47591
5 changed files with 101 additions and 46 deletions
|
|
@ -146,6 +146,24 @@ models:
|
|||
- not_null
|
||||
- unique
|
||||
|
||||
- name: int_mtd_vs_previous_year_metrics
|
||||
description: |
|
||||
This model is used for global KPIs.
|
||||
|
||||
It aggregates all the mtd models with the different metrics per source
|
||||
and computes any necessary weighted metric across different sources.
|
||||
Finally, it displays any metric on the current date, the previous year
|
||||
date and it computes the relative increment by using the macro:
|
||||
- calculate_safe_relative_increment
|
||||
|
||||
columns:
|
||||
- name: date
|
||||
data_type: date
|
||||
description: The date for the month-to-date metrics.
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: int_monthly_guest_revenue_history_by_deal
|
||||
description: |
|
||||
This model contains the historic information regarding the guest revenue for each deal id.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue