Update mtd_aggregated_metrics
This commit is contained in:
parent
60ea19f5ef
commit
c3e4a07050
3 changed files with 47 additions and 41 deletions
|
|
@ -40,7 +40,7 @@ with
|
|||
then vp.amount_without_taxes_in_gbp
|
||||
else null
|
||||
end
|
||||
) as deposit_fees_in_gbp,
|
||||
) as deposit_fees_without_taxes_in_gbp,
|
||||
sum(
|
||||
case
|
||||
when
|
||||
|
|
@ -49,7 +49,7 @@ with
|
|||
then vp.amount_without_taxes_in_gbp
|
||||
else null
|
||||
end
|
||||
) as waiver_payments_in_gbp,
|
||||
) as waiver_payments_without_taxes_in_gbp,
|
||||
sum(
|
||||
case
|
||||
when
|
||||
|
|
@ -58,7 +58,7 @@ with
|
|||
then vp.amount_without_taxes_in_gbp
|
||||
else null
|
||||
end
|
||||
) as checkin_cover_fees_in_gbp
|
||||
) as checkin_cover_fees_without_taxes_in_gbp
|
||||
from int_dates_mtd d
|
||||
inner join
|
||||
int_core__verification_payments vp
|
||||
|
|
@ -94,15 +94,21 @@ select
|
|||
d.dimension_value,
|
||||
d.is_end_of_month,
|
||||
d.is_current_month,
|
||||
nullif(gpym.deposit_fees_in_gbp, 0) as deposit_fees_in_gbp,
|
||||
nullif(gpym.waiver_payments_in_gbp, 0) as waiver_payments_in_gbp,
|
||||
nullif(gpym.checkin_cover_fees_in_gbp, 0) as checkin_cover_fees_in_gbp,
|
||||
nullif(
|
||||
coalesce(gpym.deposit_fees_in_gbp, 0)
|
||||
+ coalesce(gpym.waiver_payments_in_gbp, 0)
|
||||
+ coalesce(gpym.checkin_cover_fees_in_gbp, 0),
|
||||
gpym.deposit_fees_without_taxes_in_gbp, 0
|
||||
) as deposit_fees_without_taxes_in_gbp,
|
||||
nullif(
|
||||
gpym.waiver_payments_without_taxes_in_gbp, 0
|
||||
) as waiver_payments_without_taxes_in_gbp,
|
||||
nullif(
|
||||
gpym.checkin_cover_fees_without_taxes_in_gbp, 0
|
||||
) as checkin_cover_fees_without_taxes_in_gbp,
|
||||
nullif(
|
||||
coalesce(gpym.deposit_fees_without_taxes_in_gbp, 0)
|
||||
+ coalesce(gpym.waiver_payments_without_taxes_in_gbp, 0)
|
||||
+ coalesce(gpym.checkin_cover_fees_without_taxes_in_gbp, 0),
|
||||
0
|
||||
) as total_guest_payments_in_gbp
|
||||
) as total_guest_payments_without_taxes_in_gbp
|
||||
from int_dates_mtd_by_dimension d
|
||||
left join
|
||||
guest_payments_year_month gpym
|
||||
|
|
|
|||
|
|
@ -362,18 +362,18 @@
|
|||
{
|
||||
"order_by": 260,
|
||||
"metric": "Deposit Fees",
|
||||
"value": "deposit_fees_in_gbp",
|
||||
"previous_year_value": "previous_year_deposit_fees_in_gbp",
|
||||
"relative_increment": "relative_increment_deposit_fees_in_gbp",
|
||||
"value": "deposit_fees_without_taxes_in_gbp",
|
||||
"previous_year_value": "previous_year_deposit_fees_without_taxes_in_gbp",
|
||||
"relative_increment": "relative_increment_deposit_fees_without_taxes_in_gbp",
|
||||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
{
|
||||
"order_by": 262,
|
||||
"metric": "Waiver Amount Paid by Guests",
|
||||
"value": "waiver_payments_in_gbp",
|
||||
"previous_year_value": "previous_year_waiver_payments_in_gbp",
|
||||
"relative_increment": "relative_increment_waiver_payments_in_gbp",
|
||||
"value": "waiver_payments_without_taxes_in_gbp",
|
||||
"previous_year_value": "previous_year_waiver_payments_without_taxes_in_gbp",
|
||||
"relative_increment": "relative_increment_waiver_payments_without_taxes_in_gbp",
|
||||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
|
|
@ -398,9 +398,9 @@
|
|||
{
|
||||
"order_by": 265,
|
||||
"metric": "Check-In Hero Amount Paid by Guests",
|
||||
"value": "checkin_cover_fees_in_gbp",
|
||||
"previous_year_value": "previous_year_checkin_cover_fees_in_gbp",
|
||||
"relative_increment": "relative_increment_checkin_cover_fees_in_gbp",
|
||||
"value": "checkin_cover_fees_without_taxes_in_gbp",
|
||||
"previous_year_value": "previous_year_checkin_cover_fees_without_taxes_in_gbp",
|
||||
"relative_increment": "relative_increment_checkin_cover_fees_without_taxes_in_gbp",
|
||||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
|
|
@ -416,9 +416,9 @@
|
|||
{
|
||||
"order_by": 290,
|
||||
"metric": "Guest Payments",
|
||||
"value": "total_guest_payments_in_gbp",
|
||||
"previous_year_value": "previous_year_total_guest_payments_in_gbp",
|
||||
"relative_increment": "relative_increment_total_guest_payments_in_gbp",
|
||||
"value": "total_guest_payments_without_taxes_in_gbp",
|
||||
"previous_year_value": "previous_year_total_guest_payments_without_taxes_in_gbp",
|
||||
"relative_increment": "relative_increment_total_guest_payments_without_taxes_in_gbp",
|
||||
"number_format": "currency_gbp",
|
||||
"increment_sign_format": "positive",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -104,25 +104,25 @@ with
|
|||
invoicing.xero_host_resolution_payment_count,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
guest_payments.deposit_fees_in_gbp,
|
||||
guest_payments.waiver_payments_in_gbp,
|
||||
guest_payments.deposit_fees_without_taxes_in_gbp,
|
||||
guest_payments.waiver_payments_without_taxes_in_gbp,
|
||||
invoicing.xero_waiver_paid_back_to_host_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_payments.waiver_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.waiver_payments_without_taxes_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_in_gbp,
|
||||
guest_payments.total_guest_payments_in_gbp,
|
||||
guest_payments.checkin_cover_fees_without_taxes_in_gbp,
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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),
|
||||
|
|
@ -130,21 +130,21 @@ with
|
|||
) as total_revenue_in_gbp,
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS WEIGHTED METRICS --
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp / nullif(
|
||||
guest_journeys.completed_guest_journeys, 0
|
||||
) as guest_payments_per_completed_guest_journey,
|
||||
guest_payments.total_guest_payments_in_gbp / nullif(
|
||||
guest_payments.total_guest_payments_without_taxes_in_gbp / nullif(
|
||||
guest_journeys.paid_guest_journeys, 0
|
||||
) as guest_payments_per_paid_guest_journey,
|
||||
nullif(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_in_gbp, 0)
|
||||
+ coalesce(invoicing.xero_waiver_paid_back_to_host_in_gbp, 0),
|
||||
0
|
||||
) / nullif(
|
||||
|
|
@ -153,7 +153,7 @@ with
|
|||
|
||||
-- TOTAL REVENUE WEIGHTED METRICS --
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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)
|
||||
|
|
@ -161,7 +161,7 @@ with
|
|||
created_bookings.created_bookings, 0
|
||||
) as total_revenue_per_created_booking,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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)
|
||||
|
|
@ -169,7 +169,7 @@ with
|
|||
guest_journeys.created_guest_journeys, 0
|
||||
) as total_revenue_per_created_guest_journey,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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)
|
||||
|
|
@ -177,7 +177,7 @@ with
|
|||
deals.deals_booked_in_month, 0
|
||||
) as total_revenue_per_deals_booked_in_month,
|
||||
(
|
||||
coalesce(guest_payments.total_guest_payments_in_gbp, 0)
|
||||
coalesce(guest_payments.total_guest_payments_without_taxes_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)
|
||||
|
|
@ -300,12 +300,12 @@ select
|
|||
{{ calculate_safe_relative_increment("xero_host_resolution_payment_count") }},
|
||||
|
||||
-- GUEST REVENUE AND PAYMENTS --
|
||||
{{ calculate_safe_relative_increment("deposit_fees_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("waiver_payments_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("deposit_fees_without_taxes_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("waiver_payments_without_taxes_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_in_gbp") }},
|
||||
{{ calculate_safe_relative_increment("total_guest_payments_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("total_guest_revenue_in_gbp") }},
|
||||
|
||||
-- TOTAL REVENUE --
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue