From 2c7e396c2cd240ee54ebe791e9dbc29198ccaa00 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Wed, 16 Apr 2025 14:27:23 +0200 Subject: [PATCH] New API invoices --- ...hly_aggregated_metrics_history_by_deal.sql | 2 + .../cross/int_mtd_aggregated_metrics.sql | 22 ++++++ .../int_mtd_vs_previous_year_metrics.sql | 8 ++ ...int_kpis__agg_monthly_invoiced_revenue.sql | 6 ++ .../int_kpis__agg_mtd_invoiced_revenue.sql | 6 ++ ...nt_kpis__metric_daily_invoiced_revenue.sql | 14 ++++ ..._kpis__metric_monthly_invoiced_revenue.sql | 6 ++ .../int_kpis__metric_mtd_invoiced_revenue.sql | 6 ++ models/intermediate/kpis/schema.yml | 74 +++++++++++++++++++ ...hly_aggregated_metrics_history_by_deal.sql | 10 +++ seeds/stg_seed__accounting_aggregations.csv | 2 + 11 files changed, 156 insertions(+) diff --git a/models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql b/models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql index 258e6cd..761cde5 100644 --- a/models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql +++ b/models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql @@ -177,6 +177,8 @@ select -- APIs REVENUE -- invoiced_revenue.xero_apis_net_fees_in_gbp, invoiced_revenue.xero_e_deposit_net_fees_in_gbp, + invoiced_revenue.xero_check_in_hero_api_net_fees_in_gbp, + invoiced_revenue.xero_screen_and_protect_api_net_fees_in_gbp, invoiced_revenue.xero_guesty_net_fees_in_gbp, -- HOST RESOLUTIONS -- diff --git a/models/intermediate/cross/int_mtd_aggregated_metrics.sql b/models/intermediate/cross/int_mtd_aggregated_metrics.sql index e88e21e..3cdb02a 100644 --- a/models/intermediate/cross/int_mtd_aggregated_metrics.sql +++ b/models/intermediate/cross/int_mtd_aggregated_metrics.sql @@ -670,6 +670,28 @@ "display_exclusion": "INVOICING", "include_in_account_reporting": false, }, + { + "order_by": 247, + "metric": "Invoiced Check In Hero API Revenue", + "value": "xero_check_in_hero_api_net_fees_in_gbp", + "previous_year_value": "previous_year_xero_check_in_hero_api_net_fees_in_gbp", + "relative_increment": "relative_increment_xero_check_in_hero_api_net_fees_in_gbp", + "number_format": "currency_gbp", + "increment_sign_format": "positive", + "display_exclusion": "INVOICING", + "include_in_account_reporting": false, + }, + { + "order_by": 248, + "metric": "Invoiced Screen & Protect API Revenue", + "value": "xero_screen_and_protect_api_net_fees_in_gbp", + "previous_year_value": "previous_year_xero_screen_and_protect_api_net_fees_in_gbp", + "relative_increment": "relative_increment_xero_screen_and_protect_api_net_fees_in_gbp", + "number_format": "currency_gbp", + "increment_sign_format": "positive", + "display_exclusion": "INVOICING", + "include_in_account_reporting": false, + }, { "order_by": 250, "metric": "Guest Revenue", diff --git a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql index d122571..60e06b7 100644 --- a/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql +++ b/models/intermediate/cross/int_mtd_vs_previous_year_metrics.sql @@ -231,6 +231,8 @@ with -- APIs REVENUE -- invoiced_revenue.xero_apis_net_fees_in_gbp, invoiced_revenue.xero_e_deposit_net_fees_in_gbp, + invoiced_revenue.xero_check_in_hero_api_net_fees_in_gbp, + invoiced_revenue.xero_screen_and_protect_api_net_fees_in_gbp, invoiced_revenue.xero_guesty_net_fees_in_gbp, -- HOST RESOLUTIONS -- @@ -483,6 +485,12 @@ select -- APIs REVENUE -- {{ calculate_safe_relative_increment("xero_apis_net_fees_in_gbp") }}, {{ calculate_safe_relative_increment("xero_e_deposit_net_fees_in_gbp") }}, + {{ calculate_safe_relative_increment("xero_check_in_hero_api_net_fees_in_gbp") }}, + {{ + calculate_safe_relative_increment( + "xero_screen_and_protect_api_net_fees_in_gbp" + ) + }}, {{ calculate_safe_relative_increment("xero_guesty_net_fees_in_gbp") }}, -- HOST RESOLUTIONS -- diff --git a/models/intermediate/kpis/int_kpis__agg_monthly_invoiced_revenue.sql b/models/intermediate/kpis/int_kpis__agg_monthly_invoiced_revenue.sql index cc962ed..ed301fe 100644 --- a/models/intermediate/kpis/int_kpis__agg_monthly_invoiced_revenue.sql +++ b/models/intermediate/kpis/int_kpis__agg_monthly_invoiced_revenue.sql @@ -45,6 +45,12 @@ ) as xero_waiver_paid_back_to_host_in_gbp, sum(xero_e_deposit_net_fees_in_gbp) as xero_e_deposit_net_fees_in_gbp, sum(xero_athena_net_fees_in_gbp) as xero_athena_net_fees_in_gbp, + sum( + xero_check_in_hero_api_net_fees_in_gbp + ) as xero_check_in_hero_api_net_fees_in_gbp, + sum( + xero_screen_and_protect_api_net_fees_in_gbp + ) as xero_screen_and_protect_api_net_fees_in_gbp, sum(xero_guesty_net_fees_in_gbp) as xero_guesty_net_fees_in_gbp, sum(xero_apis_net_fees_in_gbp) as xero_apis_net_fees_in_gbp, sum( diff --git a/models/intermediate/kpis/int_kpis__agg_mtd_invoiced_revenue.sql b/models/intermediate/kpis/int_kpis__agg_mtd_invoiced_revenue.sql index 9b18211..3c01994 100644 --- a/models/intermediate/kpis/int_kpis__agg_mtd_invoiced_revenue.sql +++ b/models/intermediate/kpis/int_kpis__agg_mtd_invoiced_revenue.sql @@ -45,6 +45,12 @@ ) as xero_waiver_paid_back_to_host_in_gbp, sum(xero_e_deposit_net_fees_in_gbp) as xero_e_deposit_net_fees_in_gbp, sum(xero_athena_net_fees_in_gbp) as xero_athena_net_fees_in_gbp, + sum( + xero_check_in_hero_api_net_fees_in_gbp + ) as xero_check_in_hero_api_net_fees_in_gbp, + sum( + xero_screen_and_protect_api_net_fees_in_gbp + ) as xero_screen_and_protect_api_net_fees_in_gbp, sum(xero_guesty_net_fees_in_gbp) as xero_guesty_net_fees_in_gbp, sum(xero_apis_net_fees_in_gbp) as xero_apis_net_fees_in_gbp, sum( diff --git a/models/intermediate/kpis/int_kpis__metric_daily_invoiced_revenue.sql b/models/intermediate/kpis/int_kpis__metric_daily_invoiced_revenue.sql index 3ed44cd..cc319e2 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_invoiced_revenue.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_invoiced_revenue.sql @@ -174,6 +174,20 @@ select else 0 end ) as xero_athena_net_fees_in_gbp, + sum( + case + when ixsdm.accounting_root_aggregation = 'Check in Hero API' + then ixsdm.line_amount_wo_taxes_in_gbp + else 0 + end + ) as xero_check_in_hero_api_net_fees_in_gbp, + sum( + case + when ixsdm.accounting_root_aggregation = 'Screen and Protect API' + then ixsdm.line_amount_wo_taxes_in_gbp + else 0 + end + ) as xero_screen_and_protect_api_net_fees_in_gbp, sum( case when ixsdm.accounting_root_aggregation = 'Guesty Resolutions' diff --git a/models/intermediate/kpis/int_kpis__metric_monthly_invoiced_revenue.sql b/models/intermediate/kpis/int_kpis__metric_monthly_invoiced_revenue.sql index 7e8e496..abb62e9 100644 --- a/models/intermediate/kpis/int_kpis__metric_monthly_invoiced_revenue.sql +++ b/models/intermediate/kpis/int_kpis__metric_monthly_invoiced_revenue.sql @@ -50,6 +50,12 @@ select ) as xero_waiver_paid_back_to_host_in_gbp, sum(ir.xero_e_deposit_net_fees_in_gbp) as xero_e_deposit_net_fees_in_gbp, sum(ir.xero_athena_net_fees_in_gbp) as xero_athena_net_fees_in_gbp, + sum( + ir.xero_check_in_hero_api_net_fees_in_gbp + ) as xero_check_in_hero_api_net_fees_in_gbp, + sum( + ir.xero_screen_and_protect_api_net_fees_in_gbp + ) as xero_screen_and_protect_api_net_fees_in_gbp, sum(ir.xero_guesty_net_fees_in_gbp) as xero_guesty_net_fees_in_gbp, sum(ir.xero_apis_net_fees_in_gbp) as xero_apis_net_fees_in_gbp, sum( diff --git a/models/intermediate/kpis/int_kpis__metric_mtd_invoiced_revenue.sql b/models/intermediate/kpis/int_kpis__metric_mtd_invoiced_revenue.sql index 9bd4558..f3ba0ec 100644 --- a/models/intermediate/kpis/int_kpis__metric_mtd_invoiced_revenue.sql +++ b/models/intermediate/kpis/int_kpis__metric_mtd_invoiced_revenue.sql @@ -50,6 +50,12 @@ select ) as xero_waiver_paid_back_to_host_in_gbp, sum(ir.xero_e_deposit_net_fees_in_gbp) as xero_e_deposit_net_fees_in_gbp, sum(ir.xero_athena_net_fees_in_gbp) as xero_athena_net_fees_in_gbp, + sum( + ir.xero_check_in_hero_api_net_fees_in_gbp + ) as xero_check_in_hero_api_net_fees_in_gbp, + sum( + ir.xero_screen_and_protect_api_net_fees_in_gbp + ) as xero_screen_and_protect_api_net_fees_in_gbp, sum(ir.xero_guesty_net_fees_in_gbp) as xero_guesty_net_fees_in_gbp, sum(ir.xero_apis_net_fees_in_gbp) as xero_apis_net_fees_in_gbp, sum( diff --git a/models/intermediate/kpis/schema.yml b/models/intermediate/kpis/schema.yml index fc86f8c..4f7031d 100644 --- a/models/intermediate/kpis/schema.yml +++ b/models/intermediate/kpis/schema.yml @@ -4442,6 +4442,20 @@ models: in a given date and per specified dimension. This is an API service. + - name: xero_check_in_hero_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of daily Check-In Hero API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + + - name: xero_screen_and_protect_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of daily Screen & Protect API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + - name: xero_athena_net_fees_in_gbp data_type: decimal description: | @@ -4651,6 +4665,20 @@ models: in a given month and per specified dimension. This is an API service. + - name: xero_check_in_hero_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of accummulated Check-In Hero API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + + - name: xero_screen_and_protect_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of accummulated Screen & Protect API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + - name: xero_athena_net_fees_in_gbp data_type: decimal description: | @@ -4854,6 +4882,20 @@ models: in a given month up to the given date and per specified dimension. This is an API service. + - name: xero_check_in_hero_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of accummulated Check-In Hero API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + + - name: xero_screen_and_protect_api_net_fees_in_gbp + data_type: decimal + description: | + Sum of accummulated Screen & Protect API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + - name: xero_athena_net_fees_in_gbp data_type: decimal description: | @@ -4931,6 +4973,8 @@ models: - xero_verification_net_fees_in_gbp - xero_operator_net_fees_in_gbp - xero_e_deposit_net_fees_in_gbp + - xero_check_in_hero_api_net_fees_in_gbp + - xero_screen_and_protect_api_net_fees_in_gbp - xero_athena_net_fees_in_gbp - xero_guesty_resolutions_net_fees_in_gbp - xero_guesty_net_fees_in_gbp @@ -5041,6 +5085,20 @@ models: for a given date, dimension and value. This is an API service. + - name: xero_check_in_hero_api_net_fees_in_gbp + data_type: decimal + description: | + The monthly Check-In Hero API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + + - name: xero_screen_and_protect_api_net_fees_in_gbp + data_type: decimal + description: | + The monthly Screen & Protect API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + - name: xero_athena_net_fees_in_gbp data_type: decimal description: | @@ -5116,6 +5174,8 @@ models: - xero_verification_net_fees_in_gbp - xero_operator_net_fees_in_gbp - xero_e_deposit_net_fees_in_gbp + - xero_check_in_hero_api_net_fees_in_gbp + - xero_screen_and_protect_api_net_fees_in_gbp - xero_athena_net_fees_in_gbp - xero_guesty_resolutions_net_fees_in_gbp - xero_guesty_net_fees_in_gbp @@ -5227,6 +5287,20 @@ models: for a given date, dimension and value. This is an API service. + - name: xero_check_in_hero_api_net_fees_in_gbp + data_type: decimal + description: | + The month-to-date Check-In Hero API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + + - name: xero_screen_and_protect_api_net_fees_in_gbp + data_type: decimal + description: | + The month-to-date Screen & Protect API Net Fees, in GBP, without taxes + in a given date and per specified dimension. This is an + API service. + - name: xero_athena_net_fees_in_gbp data_type: decimal description: | diff --git a/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql b/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql index b90e40b..81bf94b 100644 --- a/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql +++ b/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql @@ -158,6 +158,16 @@ select then xero_e_deposit_net_fees_in_gbp else null end as xero_e_deposit_net_fees_in_gbp, + case + when {{ is_date_before_20th_of_previous_month("date") }} + then xero_check_in_hero_api_net_fees_in_gbp + else null + end as xero_check_in_hero_api_net_fees_in_gbp, + case + when {{ is_date_before_20th_of_previous_month("date") }} + then xero_screen_and_protect_api_net_fees_in_gbp + else null + end as xero_screen_and_protect_api_net_fees_in_gbp, case when {{ is_date_before_20th_of_previous_month("date") }} then xero_waiver_paid_back_to_host_in_gbp diff --git a/seeds/stg_seed__accounting_aggregations.csv b/seeds/stg_seed__accounting_aggregations.csv index 2af21a1..b6b77c4 100644 --- a/seeds/stg_seed__accounting_aggregations.csv +++ b/seeds/stg_seed__accounting_aggregations.csv @@ -22,6 +22,7 @@ account_code,root_aggregation,kpis_aggregation,financial_l1_aggregation,financia "221",Guesty Resolutions,Invoiced API Revenue,4-Mediation and Resolution,41-Guesty Resolutions,411-Guesty Resolutions "222",Check In Cover,Accounting Guest Revenue,3-Guest Products,31-Check In Cover,311-Check In Cover "223",Check In Cover,Accounting Guest Revenue,3-Guest Products,31-Check In Cover,311-Check In Cover +"226",Check in Hero API,Invoiced API Revenue,3-Guest Products,32-Check in Hero API,321-Check in Hero API "227",Basic Protection,Invoiced Operator Revenue,1-Guest Screening and Protection,17-Protection Services,171-Basic Protection "228",Waiver Pro,Invoiced Operator Revenue,2-Deposit Management,21-Deposit Management Services,213-Waiver Pro "229",Id Verification,Invoiced Operator Revenue,1-Guest Screening and Protection,16-Screening Services,163-Id Verification @@ -35,4 +36,5 @@ account_code,root_aggregation,kpis_aggregation,financial_l1_aggregation,financia "237",Waiver Plus,Accounting Guest Revenue,2-Deposit Management,21-Deposit Management Services,212-Waiver Plus "238",Basic Damage Deposit,Accounting Guest Revenue,2-Deposit Management,21-Deposit Management Services,214-Basic Damage Deposit "239",Resolution Process for Deposit Management Services,Accounting Resolutions,2-Deposit Management,21-Deposit Management Services,215-Resolution Process for Deposit Management Services +"240",Screen and Protect API,Invoiced API Revenue,1-Guest Screening and Protection,18-Screen and Protect API,181-Screen and Protect API "301",Damage Host-Waiver Payments,Damage Host-Waiver Payments,5-Damage Host-Waiver Payments,51-Damage Host-Waiver Payments,511-Damage Host-Waiver Payments