Merged PR 2354: Main KPIs batch 2 exposure

This PR exposes the following metrics to the Main KPIs business overview report, for both Global + By Deal view:
- Total Revenue
- Total Revenue per Booking Created
- Total Revenue per Guest Journey Created
- Total Revenue per Deals Booked in Month (does not apply on the by deal view)
- Total Revenue per Listings Booked in Month
- Invoiced Operator Revenue
- Host Resolution Payment Count
- Host Resolution Amount Paid

Keep in mind Global view will be displaying these metrics once this is merged. I also changed a bit the order of the metric display.
Note that Billable Bookings are not included.

I recommend to review by 1) checking the first commit. This is almost the same as the previous abandoned PR that @<Joaquin Ossa> you already checked on Tuesday. I added a second commit, to be checked later, which basically fixes some stupid issues that if one of the source of revenue is null, then total revenue is null. This is specially critical for the view by deal, since most of them do not have revenue from APIs - thus all total revenue figures were null...

Related work items: #18108, #18109, #18110, #18719
This commit is contained in:
Oriol Roqué Paniagua 2024-07-19 09:14:30 +00:00
parent 361ad31299
commit ee13eda5f3
7 changed files with 207 additions and 80 deletions

View file

@ -125,14 +125,20 @@ select
hnf.xero_booking_net_fees_in_gbp,
hnf.xero_listing_net_fees_in_gbp,
hnf.xero_verification_net_fees_in_gbp,
hnf.xero_booking_net_fees_in_gbp
+ hnf.xero_listing_net_fees_in_gbp
+ hnf.xero_verification_net_fees_in_gbp as xero_operator_net_fees_in_gbp,
nullif(
coalesce(hnf.xero_booking_net_fees_in_gbp, 0)
+ coalesce(hnf.xero_listing_net_fees_in_gbp, 0)
+ coalesce(hnf.xero_verification_net_fees_in_gbp, 0),
0
) as xero_operator_net_fees_in_gbp,
-- APIs --
anf.xero_e_deposit_net_fees_in_gbp,
anf.xero_guesty_net_fees_in_gbp,
anf.xero_e_deposit_net_fees_in_gbp
+ anf.xero_guesty_net_fees_in_gbp as xero_apis_net_fees_in_gbp,
nullif(
coalesce(anf.xero_e_deposit_net_fees_in_gbp, 0)
+ coalesce(anf.xero_guesty_net_fees_in_gbp, 0),
0
) as xero_apis_net_fees_in_gbp,
-- WAIVERS PAID BACK TO HOST --
hnf.xero_waiver_net_fees_in_gbp,
-- HOST RESOLUTIONS --

View file

@ -133,14 +133,20 @@ select
hnf.xero_booking_net_fees_in_gbp,
hnf.xero_listing_net_fees_in_gbp,
hnf.xero_verification_net_fees_in_gbp,
hnf.xero_booking_net_fees_in_gbp
+ hnf.xero_listing_net_fees_in_gbp
+ hnf.xero_verification_net_fees_in_gbp as xero_operator_net_fees_in_gbp,
nullif(
coalesce(hnf.xero_booking_net_fees_in_gbp, 0)
+ coalesce(hnf.xero_listing_net_fees_in_gbp, 0)
+ coalesce(hnf.xero_verification_net_fees_in_gbp, 0),
0
) as xero_operator_net_fees_in_gbp,
-- APIs --
anf.xero_e_deposit_net_fees_in_gbp,
anf.xero_guesty_net_fees_in_gbp,
anf.xero_e_deposit_net_fees_in_gbp
+ anf.xero_guesty_net_fees_in_gbp as xero_apis_net_fees_in_gbp,
nullif(
coalesce(anf.xero_e_deposit_net_fees_in_gbp, 0)
+ coalesce(anf.xero_guesty_net_fees_in_gbp, 0),
0
) as xero_apis_net_fees_in_gbp,
-- WAIVERS PAID BACK TO HOST --
hnf.xero_waiver_net_fees_in_gbp,
-- HOST RESOLUTIONS --