Merged PR 3431: Adds Invoicing metrics

# Description

Same old story: includes all metrics coming from Xero.
Adds a daily model, monthly, mtd + monthly agg and mtd agg
A test to compare values new vs. old
AND fixes the issue I mentioned with the timestamp - an issue in the old KPIs.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [X] The edited models contain PK tests, and I've ran and passed them.
- [NA] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #23565
This commit is contained in:
Oriol Roqué Paniagua 2024-11-05 16:57:23 +00:00
parent 4076f016bd
commit f5311fa954
9 changed files with 947 additions and 13 deletions

View file

@ -3233,7 +3233,7 @@ models:
data_type: bigint
description: |
Average daily CSAT score in a given date and per specified dimension.
- name: int_kpis__metric_monthly_check_in_attributed_guest_journeys
description: |
This model computes the Monthly metrics associated with Guest Journeys
@ -3769,7 +3769,7 @@ models:
Month-to-date aggregated count of guest journeys completed for a given date,
dimension, and value.
tests:
- not_null
- not_null
- name: count_csat_score
data_type: numeric
@ -4125,3 +4125,559 @@ models:
description: |
The month-to-date Host Resolution Amount Paid, in GBP, for a
given date, dimension and value.
- name: int_kpis__metric_daily_invoiced_revenue
description: |
This model computes the Daily Invoiced Revenue at the deepest granularity.
The unique key corresponds to the deepest granularity of the model,
in this case:
- date,
- id_deal.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_deal
columns:
- name: date
data_type: date
description: Date of when the document was issued.
tests:
- not_null
- name: id_deal
data_type: string
description: Unique identifier of an account.
tests:
- not_null
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
Segment value based on the number of listings booked in 12 months
for a given deal and date.
tests:
- not_null
- accepted_values:
values:
- "0"
- "01-05"
- "06-20"
- "21-60"
- "61+"
- "UNSET"
- name: main_billing_country_iso_3_per_deal
data_type: string
description: |
Main billing country of the host aggregated at Deal level.
tests:
- not_null
- name: xero_booking_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily Booking Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_listing_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily Listing Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_verification_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily Verification Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_operator_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily Operator Net Fees, which include Booking,
Listing and Verification Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_e_deposit_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily E-Deposit Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_guesty_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily Athena (Guesty) Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_apis_net_fees_in_gbp
data_type: decimal
description: |
Sum of daily API Net Fees, which include E-Deposit,
and Athena (Guesty) Net Fees, in GBP, without taxes
in a given date and per specified dimension.
- name: xero_waiver_paid_back_to_host_in_gbp
data_type: decimal
description: |
Sum of daily Waiver Amount Paid Back to Hosts, in GBP,
without taxes in a given date and per specified dimension.
- name: int_kpis__metric_monthly_invoiced_revenue
description: |
This model computes the Monthly Invoiced Revenue at the
deepest granularity.
Be aware that any dimension that can change over the monthly period,
such as daily segmentations, are included in the primary key of the
model.
The unique key corresponds to:
- end_date,
- id_deal,
- active_accommodations_per_deal_segmentation.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- end_date
- id_deal
- active_accommodations_per_deal_segmentation
columns:
- name: start_date
data_type: date
description: |
The start date of the time range considered for the metrics in this record.
tests:
- not_null
- name: end_date
data_type: date
description: |
The end date of the time range considered for the metrics in this record.
tests:
- not_null
- name: id_deal
data_type: string
description: Unique identifier of an account.
tests:
- not_null
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
Segment value based on the number of listings booked in 12 months
for a given deal and date.
tests:
- not_null
- accepted_values:
values:
- "0"
- "01-05"
- "06-20"
- "21-60"
- "61+"
- "UNSET"
- name: main_billing_country_iso_3_per_deal
data_type: string
description: |
Main billing country of the host aggregated at Deal level.
tests:
- not_null
- name: xero_booking_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Booking Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_listing_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Listing Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_verification_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Verification Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_operator_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Operator Net Fees, which include Booking,
Listing and Verification Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_e_deposit_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated E-Deposit Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_guesty_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Athena (Guesty) Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_apis_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated API Net Fees, which include E-Deposit,
and Athena (Guesty) Net Fees, in GBP, without taxes
in a given month and per specified dimension.
- name: xero_waiver_paid_back_to_host_in_gbp
data_type: decimal
description: |
Sum of accumulated Waiver Amount Paid Back to Hosts, in GBP,
without taxes in a given month and per specified dimension.
- name: int_kpis__metric_mtd_invoiced_revenue
description: |
This model computes the Month-To-Date Invoiced Revenue at the
deepest granularity.
Be aware that any dimension that can change over the monthly period,
such as daily segmentations, are included in the primary key of the
model.
The unique key corresponds to:
- end_date,
- id_deal,
- active_accommodations_per_deal_segmentation.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- end_date
- id_deal
- active_accommodations_per_deal_segmentation
columns:
- name: start_date
data_type: date
description: |
The start date of the time range considered for the metrics in this record.
tests:
- not_null
- name: end_date
data_type: date
description: |
The end date of the time range considered for the metrics in this record.
tests:
- not_null
- name: id_deal
data_type: string
description: Unique identifier of an account.
tests:
- not_null
- name: active_accommodations_per_deal_segmentation
data_type: string
description: |
Segment value based on the number of listings booked in 12 months
for a given deal and date.
tests:
- not_null
- accepted_values:
values:
- "0"
- "01-05"
- "06-20"
- "21-60"
- "61+"
- "UNSET"
- name: main_billing_country_iso_3_per_deal
data_type: string
description: |
Main billing country of the host aggregated at Deal level.
tests:
- not_null
- name: xero_booking_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Booking Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_listing_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Listing Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_verification_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Verification Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_operator_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Operator Net Fees, which include Booking,
Listing and Verification Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_e_deposit_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated E-Deposit Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_guesty_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated Athena (Guesty) Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_apis_net_fees_in_gbp
data_type: decimal
description: |
Sum of accumulated API Net Fees, which include E-Deposit,
and Athena (Guesty) Net Fees, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: xero_waiver_paid_back_to_host_in_gbp
data_type: decimal
description: |
Sum of accumulated Waiver Amount Paid Back to Hosts, in GBP, without taxes
in a given month up to the given date and per specified dimension.
- name: int_kpis__agg_monthly_invoiced_revenue
description: |
This model computes the dimension aggregation for
Monthly Invoiced Revenue.
The primary key of this model is end_date, dimension
and dimension_value.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- end_date
- dimension
- dimension_value
columns:
- name: start_date
data_type: date
description: |
The start date of the time range considered for the metrics in this record.
tests:
- not_null
- name: end_date
data_type: date
description: |
The end date of the time range considered for the metrics in this record.
tests:
- not_null
- name: dimension
data_type: string
description: The dimension or granularity of the metrics.
tests:
- assert_dimension_completeness:
metric_column_name: xero_booking_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_listing_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_verification_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_operator_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_e_deposit_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_guesty_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_apis_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_waiver_paid_back_to_host_in_gbp
- accepted_values:
values:
- global
- by_number_of_listings
- by_billing_country
- by_deal
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
tests:
- not_null
- name: xero_booking_net_fees_in_gbp
data_type: decimal
description: |
The monthly Booking Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_listing_net_fees_in_gbp
data_type: decimal
description: |
The monthly Listing Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_verification_net_fees_in_gbp
data_type: decimal
description: |
The monthly Verification Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_operator_net_fees_in_gbp
data_type: decimal
description: |
The monthly Operator Net Fees, which include Booking,
Listing and Verification Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_e_deposit_net_fees_in_gbp
data_type: decimal
description: |
The monthly E-Deposit Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_guesty_net_fees_in_gbp
data_type: decimal
description: |
The monthly Athena (Guesty) Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_apis_net_fees_in_gbp
data_type: decimal
description: |
The monthly API Net Fees, which include E-Deposit,
and Athena (Guesty) Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_waiver_paid_back_to_host_in_gbp
data_type: decimal
description: |
The monthly Waiver Amount Paid Back to Hosts, in GBP, without taxes
for a given date, dimension and value.
- name: int_kpis__agg_mtd_invoiced_revenue
description: |
This model computes the dimension aggregation for
Month-To-Date Invoiced Revenue.
The primary key of this model is end_date, dimension
and dimension_value.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- end_date
- dimension
- dimension_value
columns:
- name: start_date
data_type: date
description: |
The start date of the time range considered for the metrics in this record.
tests:
- not_null
- name: end_date
data_type: date
description: |
The end date of the time range considered for the metrics in this record.
tests:
- not_null
- name: dimension
data_type: string
description: The dimension or granularity of the metrics.
tests:
- assert_dimension_completeness:
metric_column_name: xero_booking_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_listing_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_verification_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_operator_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_e_deposit_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_guesty_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_apis_net_fees_in_gbp
- assert_dimension_completeness:
metric_column_name: xero_waiver_paid_back_to_host_in_gbp
- accepted_values:
values:
- global
- by_number_of_listings
- by_billing_country
- by_deal
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
tests:
- not_null
- name: xero_booking_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date Booking Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_listing_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date Listing Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_verification_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date Verification Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_operator_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date Operator Net Fees, which include Booking,
Listing and Verification Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_e_deposit_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date E-Deposit Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_guesty_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date Athena (Guesty) Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_apis_net_fees_in_gbp
data_type: decimal
description: |
The month-to-date API Net Fees, which include E-Deposit,
and Athena (Guesty) Net Fees, in GBP, without taxes
for a given date, dimension and value.
- name: xero_waiver_paid_back_to_host_in_gbp
data_type: decimal
description: |
The month-to-date Waiver Amount Paid Back to Hosts, in GBP,
without taxes for a given date, dimension and value.