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:
parent
361ad31299
commit
ee13eda5f3
7 changed files with 207 additions and 80 deletions
|
|
@ -27,26 +27,64 @@ select
|
|||
listings_booked_in_month as listings_booked_in_month,
|
||||
listings_booked_in_6_months as listings_booked_in_6_months,
|
||||
listings_booked_in_12_months as listings_booked_in_12_months,
|
||||
total_guest_payments_in_gbp as total_guest_payments_in_gbp,
|
||||
-- Avoid displaying revenue figures until invoicing period finishes
|
||||
-- Avoid displaying revenue figures until invoicing period finishes
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then total_revenue_in_gbp
|
||||
else null
|
||||
end as total_revenue_in_gbp,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then total_revenue_per_created_booking
|
||||
else null
|
||||
end as total_revenue_per_created_booking,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then total_revenue_per_created_guest_journey
|
||||
else null
|
||||
end as total_revenue_per_created_guest_journey,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then total_revenue_per_listings_booked_in_month
|
||||
else null
|
||||
end as total_revenue_per_listings_booked_in_month,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then xero_operator_net_fees_in_gbp
|
||||
else null
|
||||
end as xero_operator_net_fees_in_gbp,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then xero_apis_net_fees_in_gbp
|
||||
else null
|
||||
end as xero_apis_net_fees_in_gbp,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then total_guest_revenue_in_gbp
|
||||
else null
|
||||
end as total_guest_revenue_in_gbp,
|
||||
guest_payments_per_completed_guest_journey
|
||||
as guest_payments_per_completed_guest_journey,
|
||||
guest_payments_per_paid_guest_journey as guest_payments_per_paid_guest_journey,
|
||||
-- Avoid displaying revenue figures until invoicing period finishes
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then guest_revenue_per_completed_guest_journey
|
||||
else null
|
||||
end as guest_revenue_per_completed_guest_journey,
|
||||
-- Avoid displaying revenue figures until invoicing period finishes
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then guest_revenue_per_paid_guest_journey
|
||||
else null
|
||||
end as guest_revenue_per_paid_guest_journey
|
||||
end as guest_revenue_per_paid_guest_journey,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then xero_host_resolution_amount_paid_in_gbp
|
||||
else null
|
||||
end as xero_host_resolution_amount_paid_in_gbp,
|
||||
case
|
||||
when {{ is_date_before_previous_month("date") }}
|
||||
then xero_host_resolution_payment_count
|
||||
else null
|
||||
end as xero_host_resolution_payment_count,
|
||||
total_guest_payments_in_gbp as total_guest_payments_in_gbp,
|
||||
guest_payments_per_completed_guest_journey
|
||||
as guest_payments_per_completed_guest_journey,
|
||||
guest_payments_per_paid_guest_journey as guest_payments_per_paid_guest_journey
|
||||
from int_monthly_aggregated_metrics_history_by_deal
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from int_mtd_aggregated_metrics
|
|||
The following where condition is applied to avoid displaying revenue metrics
|
||||
in the MTD for the current month and the previous month. The main reason is
|
||||
that we have a time delay between when the guest does a payment vs. when we
|
||||
invoice or credit hosts (Xero).
|
||||
invoice or credit hosts (Xero). Same applies for Host Resolutions.
|
||||
This is specially tricky for the Host-takes-waiver revenue: guests payments
|
||||
happen in a timely fashion, and we get all waiver money from the guests. Once
|
||||
the month is finished, Finance will start to invoice hosts, and in this case,
|
||||
|
|
@ -37,10 +37,9 @@ from int_mtd_aggregated_metrics
|
|||
*/
|
||||
where
|
||||
(
|
||||
-- Not show current + previous month if revenue metric
|
||||
-- we need to pass +1 day to date since it's the last day of the month
|
||||
lower(metric) like '%revenue%'
|
||||
-- Not show current + previous month if revenue metric or resolution
|
||||
(lower(metric) like '%revenue%' or lower(metric) like '%resolutions%')
|
||||
and {{ is_date_before_previous_month("date") }}
|
||||
)
|
||||
-- Keep all history for the rest of metrics
|
||||
or (lower(metric) not like '%revenue%')
|
||||
or not (lower(metric) like '%revenue%' or lower(metric) like '%resolutions%')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue