Simplified it
This commit is contained in:
parent
54af8af30e
commit
3d8ede273e
3 changed files with 41 additions and 47 deletions
|
|
@ -95,25 +95,25 @@ with
|
|||
invoicing.xero_host_resolution_payment_count,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
guest_payments.deposit_fees_without_taxes_in_gbp,
|
||||
guest_payments.waiver_payments_without_taxes_in_gbp,
|
||||
guest_payments.deposit_fees_in_gbp,
|
||||
guest_payments.waiver_payments_in_gbp,
|
||||
invoicing.xero_waiver_paid_back_to_host_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_payments.waiver_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.waiver_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) as waiver_net_fees_in_gbp,
|
||||
guest_payments.checkin_cover_fees_without_taxes_in_gbp,
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp,
|
||||
guest_payments.checkin_cover_fees_in_gbp,
|
||||
guest_payments.total_guest_payments_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) as total_guest_revenue_in_gbp,
|
||||
|
||||
-- TOTAL REVENUE --
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0),
|
||||
|
|
@ -121,21 +121,21 @@ with
|
|||
) as total_revenue_in_gbp,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS WEIGHTED METRICS --
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_journeys.completed_guest_journeys, 0
|
||||
) as guest_payments_per_completed_guest_journey,
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_journeys.paid_guest_journeys, 0
|
||||
) as guest_payments_per_paid_guest_journey,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
guest_journeys.completed_guest_journeys, 0
|
||||
) as guest_revenue_per_completed_guest_journey,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
|
|
@ -144,14 +144,14 @@ with
|
|||
|
||||
-- TOTAL REVENUE WEIGHTED METRICS --
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
)
|
||||
/ nullif(bookings.created_bookings, 0) as total_revenue_per_created_booking,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -159,7 +159,7 @@ with
|
|||
guest_journeys.created_guest_journeys, 0
|
||||
) as total_revenue_per_created_guest_journey,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -167,7 +167,7 @@ with
|
|||
deals.deals_booked_in_month, 0
|
||||
) as total_revenue_per_deals_booked_in_month,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_apis_net_fees_in_gbp, 0)
|
||||
|
|
@ -275,12 +275,12 @@ select
|
|||
{{ calculate_safe_relative_increment("xero_host_resolution_payment_count") }},
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
{{ calculate_safe_relative_increment("deposit_fees_without_taxes_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("waiver_payments_without_taxes_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("deposit_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("waiver_payments_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("xero_waiver_paid_back_to_host_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("waiver_net_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("checkin_cover_fees_without_taxes_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("total_guest_payments_without_taxes_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("checkin_cover_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("total_guest_payments_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("total_guest_revenue_in_gbp") }},
|
||||
|
||||
-- TOTAL REVENUE --
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue