Merged PR 3939: Fixes DWH models for new PBI on AM

# Description

Mostly 2 changes:
* Fix metrics with coalesces so values are displayed
* Removes ratios, no longer needed. These are computed in PBI directly, to be able to compute the total figure correctly

# 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: #25829
This commit is contained in:
Oriol Roqué Paniagua 2025-01-03 16:17:26 +00:00
parent 6d261e281e
commit f2abd16a44
4 changed files with 108 additions and 110 deletions

View file

@ -22,17 +22,10 @@ select
total_revenue_in_gbp as total_revenue_in_gbp,
revenue_retained_in_gbp as revenue_retained_in_gbp,
waiver_paid_back_to_host_in_gbp as waiver_paid_back_to_host_in_gbp,
revenue_retained_ratio as revenue_retained_ratio,
invoiced_revenue_in_gbp as invoiced_revenue_in_gbp,
guest_payments_in_gbp as guest_payments_in_gbp,
guest_revenue_retained_in_gbp as guest_revenue_retained_in_gbp,
guest_revenue_retained_ratio as guest_revenue_retained_ratio,
host_resolution_payment_count as host_resolution_payment_count,
host_resolution_amount_paid_in_gbp as host_resolution_amount_paid_in_gbp,
revenue_retained_post_resolutions_in_gbp
as revenue_retained_post_resolutions_in_gbp,
revenue_retained_post_resolutions_ratio_to_retained_revenue
as revenue_retained_post_resolutions_ratio_to_retained_revenue,
revenue_retained_post_resolutions_ratio_to_total_revenue
as revenue_retained_post_resolutions_ratio_to_total_revenue
revenue_retained_post_resolutions_in_gbp as revenue_retained_post_resolutions_in_gbp
from int_monthly_aggregated_metrics_history_by_deal_by_time_window

View file

@ -1373,7 +1373,7 @@ models:
description: |
This model aggregates monthly historic metrics for deals over different time windows.
It provides insights into bookings, listings, revenue, retained revenue and
additional ratios.
additional metrics.
The data is segmented by deal and time window for detailed analysis.
tests:
@ -1407,6 +1407,7 @@ models:
- accepted_values:
values:
- Previous 12 months
- Previous 6 months
- Previous 3 months
- Previous month
@ -1513,17 +1514,6 @@ models:
in the time window. It can be null if no waivers were
paid back. It's displayed as a negative value.
- name: revenue_retained_ratio
data_type: decimal
description: |
Ratio of the revenue retained by the deal with respect
to the total revenue generated in the time window.
It can be null if no revenue was generated. In some
extreme cases, waiver paid back to host can be higher
than zero thus this ratio can be higher than 1. In some
cases the ratio can be lower than 0 if we payout more
than we retain.
- name: invoiced_revenue_in_gbp
data_type: decimal
description: |
@ -1551,16 +1541,6 @@ models:
It can be null if no revenue was retained from the guest.
It can be negative.
- name: guest_revenue_retained_ratio
data_type: decimal
description: |
Ratio of the revenue retained by the deal from the guest
with respect to the total revenue generated in the time window.
It can be null if no guest revenue was generated. In some
extreme cases, this ratio can be higher than 1 if waiver paid
back to host is higher than zero. Additionally, in some cases,
the ratio can be lower than 0 if we payout more than we retain.
- name: host_resolution_payment_count
data_type: integer
description: |
@ -1588,21 +1568,3 @@ models:
post waiver payouts and resolution payouts in the time window.
It can be null if no revenue was retained post resolution payments.
It can be negative, thus indicating that we are losing money.
- name: revenue_retained_post_resolutions_ratio_to_retained_revenue
data_type: decimal
description: |
Ratio of the revenue retained by the deal post resolution
payments with respect to the revenue retained by the deal
in the time window. It can be null if no revenue was retained
post resolution payments. In some extreme cases, this ratio
can be lower and higher than 0 and 1, respectively.
- name: revenue_retained_post_resolutions_ratio_to_total_revenue
data_type: decimal
description: |
Ratio of the revenue retained by the deal post resolution
payments with respect to the total revenue generated by the deal
in the time window. It can be null if no revenue was generated.
In some extreme cases, this ratio can be lower and higher than 0 and 1,
respectively.