Fixed macro
This commit is contained in:
parent
e4d19b85e8
commit
720185f235
3 changed files with 68 additions and 56 deletions
|
|
@ -289,8 +289,14 @@ with
|
|||
cast(host_resolutions.xero_host_resolution_amount_paid_in_gbp as decimal)
|
||||
/ created_bookings.created_bookings
|
||||
as host_resolution_amount_paid_per_created_booking,
|
||||
cast(host_resolutions.xero_host_resolution_payment_count as decimal)
|
||||
/ created_bookings.created_bookings
|
||||
{{
|
||||
return_capped_value(
|
||||
"cast(host_resolutions.xero_host_resolution_payment_count as decimal)
|
||||
/ created_bookings.created_bookings",
|
||||
-1,
|
||||
1
|
||||
)
|
||||
}}
|
||||
as host_resolution_payment_per_created_booking_ratio,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
|
|
@ -364,31 +370,42 @@ with
|
|||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) as revenue_retained_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0),
|
||||
0
|
||||
) as revenue_retained_ratio,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(host_resolutions.xero_host_resolution_amount_paid_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0),
|
||||
0
|
||||
) as revenue_retained_post_resolutions_ratio,
|
||||
{{
|
||||
return_capped_value(
|
||||
"nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0),
|
||||
0
|
||||
)",
|
||||
-1,
|
||||
1
|
||||
)}} as revenue_retained_ratio,
|
||||
{{
|
||||
return_capped_value(
|
||||
"nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_waiver_paid_back_to_host_in_gbp, 0)
|
||||
+ coalesce(host_resolutions.xero_host_resolution_amount_paid_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_operator_net_fees_in_gbp, 0)
|
||||
+ coalesce(invoiced_revenue.xero_apis_net_fees_in_gbp, 0),
|
||||
0
|
||||
)",
|
||||
-1,
|
||||
1
|
||||
)
|
||||
}} as revenue_retained_post_resolutions_ratio,
|
||||
|
||||
-- INCOME RETAINED POST RESOLUTIONS--
|
||||
nullif(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue