diff --git a/models/intermediate/cross/int_mtd_aggregated_metrics.sql b/models/intermediate/cross/int_mtd_aggregated_metrics.sql index 024d692..0a25028 100644 --- a/models/intermediate/cross/int_mtd_aggregated_metrics.sql +++ b/models/intermediate/cross/int_mtd_aggregated_metrics.sql @@ -7,6 +7,7 @@ "relative_increment": "relative_increment_created_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 2, @@ -16,6 +17,7 @@ "relative_increment": "relative_increment_check_out_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 3, @@ -25,6 +27,7 @@ "relative_increment": "relative_increment_billable_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 4, @@ -34,6 +37,7 @@ "relative_increment": "relative_increment_billable_check_out_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 5, @@ -43,6 +47,7 @@ "relative_increment": "relative_increment_not_cancelled_created_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 6, @@ -52,6 +57,7 @@ "relative_increment": "relative_increment_cancelled_created_bookings", "number_format": "integer", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 7, @@ -61,6 +67,7 @@ "relative_increment": "relative_increment_not_cancelled_check_out_bookings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 8, @@ -70,6 +77,7 @@ "relative_increment": "relative_increment_cancelled_check_out_bookings", "number_format": "integer", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 10, @@ -79,6 +87,7 @@ "relative_increment": "relative_increment_created_guest_journeys", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 11, @@ -88,6 +97,7 @@ "relative_increment": "relative_increment_started_guest_journeys", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 12, @@ -97,6 +107,7 @@ "relative_increment": "relative_increment_completed_guest_journeys", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 13, @@ -106,6 +117,7 @@ "relative_increment": "relative_increment_paid_guest_journeys", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 20, @@ -115,6 +127,7 @@ "relative_increment": "relative_increment_live_deals", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 21, @@ -124,6 +137,7 @@ "relative_increment": "relative_increment_new_deals", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 22, @@ -133,6 +147,7 @@ "relative_increment": "relative_increment_deals_booked_in_month", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 23, @@ -142,6 +157,7 @@ "relative_increment": "relative_increment_deals_booked_in_6_months", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 24, @@ -151,6 +167,7 @@ "relative_increment": "relative_increment_deals_booked_in_12_months", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 25, @@ -160,6 +177,7 @@ "relative_increment": "relative_increment_churning_deals", "number_format": "integer", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 30, @@ -169,6 +187,7 @@ "relative_increment": "relative_increment_new_listings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 31, @@ -178,6 +197,7 @@ "relative_increment": "relative_increment_first_time_booked_listings", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 32, @@ -187,6 +207,7 @@ "relative_increment": "relative_increment_listings_booked_in_month", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 33, @@ -196,6 +217,7 @@ "relative_increment": "relative_increment_listings_booked_in_6_months", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 34, @@ -205,6 +227,7 @@ "relative_increment": "relative_increment_listings_booked_in_12_months", "number_format": "integer", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 35, @@ -214,6 +237,7 @@ "relative_increment": "relative_increment_churning_listings", "number_format": "integer", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 40, @@ -223,6 +247,7 @@ "relative_increment": "relative_increment_xero_host_resolution_payment_count", "number_format": "integer", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 100, @@ -232,6 +257,7 @@ "relative_increment": "relative_increment_revenue_retained_ratio", "number_format": "percentage", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 101, @@ -241,6 +267,7 @@ "relative_increment": "relative_increment_revenue_retained_post_resolutions_ratio", "number_format": "percentage", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 102, @@ -250,6 +277,7 @@ "relative_increment": "relative_increment_host_resolution_payment_per_created_booking_ratio", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 110, @@ -259,6 +287,7 @@ "relative_increment": "relative_increment_cancelled_created_bookings_rate", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 111, @@ -268,6 +297,7 @@ "relative_increment": "relative_increment_cancelled_check_out_bookings_rate", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 120, @@ -277,6 +307,7 @@ "relative_increment": "relative_increment_start_rate_guest_journey", "number_format": "percentage", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 121, @@ -286,6 +317,7 @@ "relative_increment": "relative_increment_completion_rate_guest_journey", "number_format": "percentage", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 122, @@ -295,6 +327,7 @@ "relative_increment": "relative_increment_incompletion_rate_guest_journey", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 123, @@ -304,6 +337,7 @@ "relative_increment": "relative_increment_payment_rate_guest_journey", "number_format": "percentage", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 130, @@ -313,6 +347,7 @@ "relative_increment": "relative_increment_total_revenue_churn_average_contribution", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "ONGOING_MONTH", }, { "order_by": 131, @@ -322,6 +357,7 @@ "relative_increment": "relative_increment_created_bookings_churn_average_contribution", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "ONGOING_MONTH", }, { "order_by": 132, @@ -331,6 +367,7 @@ "relative_increment": "relative_increment_listings_booked_in_month_churn_average_contribution", "number_format": "percentage", "increment_sign_format": "negative", + "display_exclusion": "ONGOING_MONTH", }, { "order_by": 200, @@ -340,6 +377,7 @@ "relative_increment": "relative_increment_total_revenue_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 201, @@ -349,6 +387,7 @@ "relative_increment": "relative_increment_revenue_retained_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 202, @@ -358,6 +397,7 @@ "relative_increment": "relative_increment_revenue_retained_post_resolutions_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 203, @@ -367,6 +407,7 @@ "relative_increment": "relative_increment_expected_mrr_per_deal", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "ONGOING_MONTH", }, { "order_by": 204, @@ -376,6 +417,7 @@ "relative_increment": "relative_increment_expected_mrr", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "ONGOING_MONTH", }, { "order_by": 211, @@ -385,6 +427,7 @@ "relative_increment": "relative_increment_total_revenue_per_created_booking", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 212, @@ -394,6 +437,7 @@ "relative_increment": "relative_increment_total_revenue_per_created_guest_journey", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 213, @@ -403,6 +447,7 @@ "relative_increment": "relative_increment_total_revenue_per_deals_booked_in_month", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 214, @@ -412,6 +457,7 @@ "relative_increment": "relative_increment_total_revenue_per_listings_booked_in_month", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 220, @@ -421,6 +467,7 @@ "relative_increment": "relative_increment_xero_operator_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 224, @@ -430,6 +477,7 @@ "relative_increment": "relative_increment_xero_booking_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 225, @@ -439,6 +487,7 @@ "relative_increment": "relative_increment_xero_old_dashboard_booking_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 226, @@ -448,6 +497,7 @@ "relative_increment": "relative_increment_xero_listing_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 227, @@ -457,6 +507,7 @@ "relative_increment": "relative_increment_xero_verification_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 231, @@ -466,6 +517,7 @@ "relative_increment": "relative_increment_xero_screening_plus_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 232, @@ -475,6 +527,7 @@ "relative_increment": "relative_increment_xero_id_verification_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 233, @@ -484,6 +537,7 @@ "relative_increment": "relative_increment_xero_sex_offenders_check_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 234, @@ -493,6 +547,7 @@ "relative_increment": "relative_increment_xero_waiver_pro_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 235, @@ -502,6 +557,7 @@ "relative_increment": "relative_increment_xero_basic_protection_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 236, @@ -511,6 +567,7 @@ "relative_increment": "relative_increment_xero_protection_plus_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 237, @@ -520,6 +577,7 @@ "relative_increment": "relative_increment_xero_protection_pro_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 240, @@ -529,6 +587,7 @@ "relative_increment": "relative_increment_xero_apis_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 245, @@ -538,6 +597,7 @@ "relative_increment": "relative_increment_xero_guesty_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 246, @@ -547,6 +607,7 @@ "relative_increment": "relative_increment_xero_e_deposit_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 250, @@ -556,6 +617,7 @@ "relative_increment": "relative_increment_total_guest_payments_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 251, @@ -565,6 +627,7 @@ "relative_increment": "relative_increment_guest_payments_per_completed_guest_journey", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 252, @@ -574,6 +637,7 @@ "relative_increment": "relative_increment_guest_payments_per_paid_guest_journey", "number_format": "converted_metric_currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 260, @@ -583,6 +647,7 @@ "relative_increment": "relative_increment_deposit_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 262, @@ -592,6 +657,7 @@ "relative_increment": "relative_increment_waiver_payments_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 263, @@ -601,6 +667,7 @@ "relative_increment": "relative_increment_xero_waiver_paid_back_to_host_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "negative", + "display_exclusion": "INVOICING", }, { "order_by": 264, @@ -610,6 +677,7 @@ "relative_increment": "relative_increment_waiver_net_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "INVOICING", }, { "order_by": 265, @@ -619,6 +687,7 @@ "relative_increment": "relative_increment_checkin_cover_fees_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "positive", + "display_exclusion": "NONE", }, { "order_by": 270, @@ -628,6 +697,7 @@ "relative_increment": "relative_increment_xero_host_resolution_amount_paid_in_gbp", "number_format": "currency_gbp", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, { "order_by": 271, @@ -637,6 +707,7 @@ "relative_increment": "relative_increment_host_resolution_amount_paid_per_created_booking", "number_format": "currency_gbp", "increment_sign_format": "negative", + "display_exclusion": "NONE", }, ] %} with @@ -659,6 +730,7 @@ with {{ metric.order_by }} as order_by, -- quotation marks added because text format '{{ metric.number_format }}' as number_format, + '{{ metric.display_exclusion }}' as display_exclusion, '{{ metric.metric }}' as metric, {{ metric.value }} as value, {{ metric.previous_year_value }} as previous_year_value, diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index c7ee65a..15497cd 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -281,6 +281,20 @@ models: order for displaying purposes. Null values are accepted, but keep in mind that then there's no default controlled display order. + - name: display_exclusion + data_type: string + description: | + Category to indicate if the metric requires a certain exclusion due + to relying on not timely information. + This will limit the display for reporting purposes. + data_tests: + - not_null + - accepted_values: + values: + - NONE + - INVOICING + - ONGOING_MONTH + - name: number_format data_type: text description: allows for grouping and formatting for displaying purposes. diff --git a/models/reporting/general/mtd_aggregated_metrics.sql b/models/reporting/general/mtd_aggregated_metrics.sql index cd3da5b..c35cc8d 100644 --- a/models/reporting/general/mtd_aggregated_metrics.sql +++ b/models/reporting/general/mtd_aggregated_metrics.sql @@ -50,52 +50,23 @@ select previous_year_value as previous_year_value, relative_increment as relative_increment, relative_increment_with_sign_format as relative_increment_with_sign_format -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). 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, - all hosts that have the Host-takes-waiver need to be payed back the amount - coming from the guest. - Not having this filter would mean that, in the current month, the figures - displayed of guest revenue would be much larger than they actually will be - because we still need to pay back to the hosts these waivers. - For a more current-month evaluation, Guest Payments should be a good proxy - metric to follow. -*/ +from int_mtd_aggregated_metrics m where ( ( - -- Not show current + previous month if the metric depends on invoicing - -- cycle and it is before the 20th of the month, if it is the 20th of - -- the month or after, only exclude the current month. - ( - lower(metric) like '%total revenue%' - or lower(metric) like '%resolutions%' - or lower(metric) like '%invoiced%' - or lower(metric) like '%retained%' - or lower(metric) like '%damage host%' - ) + -- Not show current + previous month if the metric depends on + -- invoicing cycle and it is before the 20th of the month, if it + -- is the 20th of the month or after, only exclude the current + -- month. + display_exclusion = 'INVOICING' and {{ is_date_before_20th_of_previous_month("date") }} ) - -- Keep all history for the rest of metrics - or not - ( - lower(metric) like '%total revenue%' - or lower(metric) like '%resolutions%' - or lower(metric) like '%invoiced%' - or lower(metric) like '%retained%' - or lower(metric) like '%damage host%' + or ( + -- Handle exclusion for Churn/MRR metrics: do not show them in the + -- current month. + display_exclusion = 'ONGOING_MONTH' + and date_trunc('month', m.date) < date_trunc('month', current_date) ) - ) - -- If metric is Churn Rate or Expected MRR, do not show month in progress. - -- Unlike other revenue metrics, Expected MRR is calculated for the next month, - -- so it is not affected by the invoicing cycle. - and not ( - (lower(metric) like '%churn rate%' or lower(metric) like '%mrr%') - and is_current_month = true + -- Keep all history for the rest of metrics + or display_exclusion = 'NONE' )