version: 2 models: - name: dates description: | A dates dimension. Each record represents one calendar day. All othe columns have handy representations of the date, its subcomponents, and other relative dates. This table is generated with the dbt date package: https://hub.getdbt.com/calogica/dbt_date/latest/. columns: - name: date_day data_type: date description: The date this record represents. All relative dates are relative to this. All derived date components are derived from this. - name: prior_date_day data_type: date description: The day before date day. - name: next_date_day data_type: date description: The day after date day. - name: prior_year_date_day data_type: date description: The same day of the same month, but in the previous year. If date day is Feb 29th, this col returns Feb 28th. - name: prior_year_over_year_date_day data_type: date description: The day placed 365 days before the date day. Behaves a bit funny with leap years. - name: day_of_week data_type: integer description: The day of the week as a number, were Monday is 1 and Sunday is 7. - name: day_of_week_name data_type: text description: The full name of the day of the week. - name: day_of_week_name_short data_type: text description: The day of the week as a 3 digit shortened version. - name: day_of_month data_type: integer description: The day of the month as a number. - name: day_of_year data_type: integer description: The day of the year as a number, where January 1st is 1 and December 31st is 365/366. - name: week_start_date data_type: date description: | The full date for the first day of the week of date day. It considers Sunday to be the first day of the week. - name: week_end_date data_type: date description: | The full date for the last day of the week of date day. It considers Saturday to be the last day of the week. - name: prior_year_week_start_date data_type: date description: Same as week_start_date, but for the same date day in the previous year. - name: prior_year_week_end_date data_type: date description: Same as week_end_date, but for the same date day in the previous year. - name: week_of_year data_type: integer description: The week of the year as a number, where the first week is 1 and the last week is 52/53. - name: iso_week_start_date data_type: date description: | The full date for the first day of the week of date day, according to ISO specs. It considers Monday to be the first day of the week. Read more here: https://en.wikipedia.org/wiki/ISO_week_date - name: iso_week_end_date data_type: date description: | The full date for the last day of the week of date day, according to ISO specs. It considers Sunday to be the last day of the week. Read more here: https://en.wikipedia.org/wiki/ISO_week_date - name: prior_year_iso_week_start_date data_type: date description: "Read more here: https://en.wikipedia.org/wiki/ISO_week_date" - name: prior_year_iso_week_end_date data_type: date description: "Read more here: https://en.wikipedia.org/wiki/ISO_week_date" - name: iso_week_of_year data_type: integer description: "Read more here: https://en.wikipedia.org/wiki/ISO_week_date" - name: prior_year_week_of_year data_type: integer description: "" - name: prior_year_iso_week_of_year data_type: integer description: "Read more here: https://en.wikipedia.org/wiki/ISO_week_date" - name: month_of_year data_type: integer description: The month date day belongs to as a number (1 for Jan, 12 for Dec). - name: month_name data_type: text description: The month date day belongs to in English. - name: month_name_short data_type: text description: The month date day belongs to as a 3 digit shortened version. - name: month_number_name data_type: text description: The month date number with leading zero and full month name (e.g., 01-January, 02-February). - name: month_number_name_short data_type: text description: The month date number with leading zero and abbreviated month name (e.g., 01-Jan, 02-Feb). - name: month_start_date data_type: date description: The full date for the first day of the month. - name: month_end_date data_type: date description: The full date for the last day of the month. - name: prior_year_month_start_date data_type: date description: The full date for the first day of the same month last year. - name: prior_year_month_end_date data_type: date description: The full date for the last day of the same month last year. - name: quarter_of_year data_type: integer description: The quarter date day belongs to as a number (1 for Q1, 4 for Q4). - name: quarter_start_date data_type: date description: The full date for the first date of the quarter. - name: quarter_end_date data_type: date description: The full date for the last date of the quarter. - name: year_number data_type: integer description: The year date day belongs to as a number. - name: year_start_date data_type: date description: The full date for the first day of the year. - name: year_end_date data_type: date description: The full date for the last day of the year. - name: daily_currency_exchange_rates config: grants: select: ["billingdb_reader"] description: This model holds a lot of data on currency exchange rates. The time granularity is daily. Each record holds a currency pair for a specific day, source and version. Actual rates are sourced from xe.com data. The `guessed` and `forecast` versions are built by simply 'pushing' the first/last exchange rate on record. Basically, wherever we don't have data for a date, we pick the closest actual data point that comes from xe.com. Bear in mind this means that `forecast` version records will change on a daily basis as actual data moves forwards, meaning you shouldn't assume your money amounts converted in the future should always stay put. Note that, given the dimensionality, getting a simple time series for a currency pair will require a bit of filtering. Reverse rates are explicit. This means that, for any given day and any given currency pair, you will find two records with opposite from/to positions. So, for 2024-01-01, you will find both a EUR->USD record and a USD->EUR record with the opposite rate (1/rate). columns: - name: id_exchange_rate data_type: text description: A unique ID for the record, derived from concatenating the currencies, date, source and version. Currency order is relevant (EURUSD != USDEUR). data_tests: - not_null - unique - name: from_currency data_type: character description: The source currency, represented as an ISO 4217 code. data_tests: - not_null - name: to_currency data_type: character description: The target currency, represented as an ISO 4217 code. data_tests: - not_null - name: rate data_type: numeric description: >- The exchange rate, represented as the units of the target currency that one unit of source currency gets you. So, from_currency=USD to to_currency=PLN with rate=4.2 should be read as '1 US Dollar buys me 4.2 Polish Zlotys'. For same currency pairs (EUR to EUR, USD to USD, etc). The rate will always be one. The rate can be smaller than one, but can't be negative. data_tests: - not_negative_or_zero - not_null - name: rate_date_utc data_type: date description: The date in which the rate record is relevant. data_tests: - not_null - name: source data_type: text description: Where is the data coming from. Records that are composed from making assumptions on real data will contain `_inferred`. - name: rate_version data_type: text description: The version of the rate. This can be one of `actual` (the rate is a reality fact), `forecast` (the rate sits in the future and is a guess in nature) or `guess` (the rate sits in the past and is a guess in nature). Note that one currency pair can have multiple rate versions on the same date. data_tests: - accepted_values: values: - guess - actual - forecast - not_null - name: updated_at_utc data_type: timestamp with time zone description: For external sources, this will be the point in time when the information was obtained from them. For stuff we make up here in the DWH, this will be the point in time when we made the assumption. data_tests: - not_null - name: simple_exchange_rates description: >- A simplified vision of exchange rates, derived from `int_daily_currency_exchange_rates`. Come here if you don't want to understand nuances and complexities and just want to convert rates. The time granularity is daily. Each record holds a currency pair for a specific day. You will only find one conversion rate per currency pair and date. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - from_currency - to_currency - rate_date_utc columns: - name: from_currency data_type: character description: The source currency, represented as an ISO 4217 code. data_tests: - not_null - name: to_currency data_type: character description: The source currency, represented as an ISO 4217 code. data_tests: - not_null - name: rate data_type: numeric description: The target currency, represented as an ISO 4217 code. data_tests: - not_null - name: rate_date_utc data_type: date description: The date in which the rate record is relevant. data_tests: - not_null - name: updated_at_utc data_type: timestamp with time zone description: For external sources, this will be the point in time when the information was obtained from them. For stuff we make up here in the DWH, this will be the point in time when we made the assumption. data_tests: - not_null - name: mtd_aggregated_metrics description: | This model aggregates the historic information of our business by providing different metrics computed at global and dimension level. It's the main source of information for the Main KPIs reporting, specifically on the MTD (Month To Date) and the Monthly Overview. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - date - metric - dimension - dimension_value columns: - name: year data_type: int description: Year number of the given date. data_tests: - not_null - name: month data_type: int description: Month number of the given date. data_tests: - not_null - name: day data_type: int description: Day monthly number of the given date. data_tests: - not_null - name: is_end_of_month data_type: boolean description: Is end of month, 1 for yes, 0 for no. data_tests: - not_null - name: is_current_month data_type: boolean description: | Checks if the date is within the current executed month, 1 for yes, 0 for no. data_tests: - not_null - name: is_end_of_month_or_yesterday data_type: boolean description: | Checks if the date is end of month or yesterday, 1 for yes, 0 for no. data_tests: - not_null - name: first_day_month data_type: date description: | First day of the month corresponding to the date field. It comes from int_dates_mtd logic. data_tests: - not_null - name: date data_type: date description: | Main date for the computation, that is used for filters. It comes from int_dates_mtd logic. data_tests: - not_null - latest_date_is_yesterday - name: dimension data_type: string description: | The dimension or granularity of the metrics. Keep in mind that in this reporting model this field corresponds to the dimension_display; this is, the name of the dimension for displaying purposes. data_tests: - not_null - name: dimension_value data_type: string description: The value or segment available for the selected dimension. data_tests: - not_null - name: previous_year_date data_type: date description: | Corresponds to the date of the previous year, with respect to the field date. It comes from int_dates_mtd logic. It's only displayed for information purposes, should not be needed for reporting. - name: metric data_type: text description: Name of the business metric. data_tests: - not_null - name: order_by data_type: integer description: | Order for displaying purposes. Null values are accepted, but keep in mind that then there's no default controlled display order. - name: number_format data_type: text description: Allows for grouping and formatting for displaying purposes. data_tests: - accepted_values: values: [ "integer", "percentage", "currency_gbp", "converted_metric_currency_gbp", ] - name: value data_type: numeric description: | Numeric value (integer or decimal) that corresponds to the MTD computation of the metric at a given date. Note that if the month is not in progress, then this value corresponds to the monthly figure. - name: previous_year_value data_type: numeric description: | Numeric value (integer or decimal) that corresponds to the MTD computation of the metric on the previous year at a given date. - name: relative_increment data_type: numeric description: | Numeric value that corresponds to the relative increment between value and previous year value, following the computation: value / previous_year_value - 1. - name: relative_increment_with_sign_format data_type: numeric description: | Relative_increment value multiplied by -1 in case this metric's growth doesn't have a positive impact for Truvi, otherwise is equal to relative_increment. This value is specially created for formatting in PBI - name: new_dash_booking_summary description: | This model contains enriched information aggregated at Booking level regarding the services that are applied within a Booking, only for users in New Dash. Specifically, contains both Booking and Services attributes (aggregated), as well as the total price in GBP at this specific moment in time. In other words, it's the snapshot of the current status of the Booking. It's a subset of all bookings since it only applies to bookings that come from hosts that have been migrated into the New Dash. columns: - name: id_booking data_type: bigint description: | The identifier of the booking. Acts as Primary Key to this table. Cannot be null. data_tests: - not_null - unique - name: has_verification_request data_type: boolean description: | Flag to identify if the booking has a verification request or not. Cannot be null. data_tests: - not_null - name: id_deal data_type: string description: | Unique identifier of the account. It cannot be null. data_tests: - not_null - name: main_billing_country data_type: string description: | ISO 3166-1 alpha-3 main country code in which the Deal is billed. - name: main_deal_name data_type: string description: | Main name for this ID deal, according to some logic from backend (core) data. It's a clean version of the most repeated name within the user tables in the fields of first_name, last_name and company name. This field should be modified at the moment we have a proper way to retrieve a common account name per deal. It can contain duplicates. data_tests: - not_null - name: hubspot_deal_name data_type: string description: | Name of the deal according to Hubspot. Preferred over main_deal_name. - name: account_manager data_type: string description: | The name of the account manager that is currently taking care of this deal. - name: booking_status data_type: string description: | The current status of the booking. Cannot be null. data_tests: - not_null - name: program_name data_type: string description: | The name of the program, or product bundle, applied to the booking. Cannot be null. data_tests: - not_null - name: booking_created_date_utc data_type: date description: | Date of when the Booking record was created in the Backend. Cannot be null. data_tests: - not_null - name: booking_check_in_date_utc data_type: timestamp description: | Date of the Check-in of the Booking. Cannot be null. data_tests: - not_null - name: booking_check_out_date_utc data_type: date description: | Date of the Check-out of the Booking. data_tests: - not_null - name: booking_created_month data_type: date description: | First day of the month of when the Booking record was created in the Backend. Cannot be null. data_tests: - not_null - name: booking_check_in_month data_type: timestamp description: | First day of the month of the Check-in of the Booking. Cannot be null. data_tests: - not_null - name: booking_check_out_month data_type: date description: | First day of the month of the Check-out of the Booking. data_tests: - not_null - name: booking_number_of_nights data_type: integer description: | Number of nights between Check-in date and Check-out date. - name: host_currency_code data_type: string description: | Iso 4217 currency code for the account of the Host. It can be null. - name: new_dash_version data_type: string description: | Specifies the New Dash Version in which these users were moved or joined. data_tests: - not_null - name: user_in_new_dash_since_date_utc data_type: date description: | The effective date since the user can be considered in New Dash. If the user has moved from Old Dash, it will be the date of new_dash_move_at_utc. If not, it will correspond to the date of joined_at_utc. - name: booking_total_price_in_gbp data_type: decimal description: | Identifies the current total price of the booking by adding up the prices of each service applied to this booking, converted in GBP. Can be null. Can vary over time depending on the service status, payments, etc, as well as it can vary over time until the chargeable date due to the currency rate estimation in the future. - name: service_first_chargeable_date_utc data_type: date description: | Identifies the first moment in time in which the first service applied to this booking is supposed to be charged. - name: service_last_chargeable_date_utc data_type: date description: | Identifies the last moment in time in which the last service applied to this booking is supposed to be charged. - name: number_of_applied_services data_type: integer description: | Total number of Services applied to this Booking. - name: number_of_applied_upgraded_services data_type: integer description: | Total number of Services different from Basic Screening applied to this Booking. - name: is_booking_chargeable data_type: boolean description: | Flag to identify it the Booking is chargeable or not. In essence, it solves the question: are we supposed to get money out of this booking, or not? To be considered as chargeable, a chargeable date needs to exist as well as the total price converted to GBP needs to be strictly greater than 0. The fact that a booking is not chargeable does not necessarily mean that it won't be in the future. Similarly, if the booking is chargeable it does not necessarily mean that is actually charged. It cannot be null. data_tests: - not_null - name: is_booking_cancelled data_type: boolean description: | Flag to identify if the booking has been cancelled or not. - name: has_upgraded_services data_type: boolean description: | Flag to identify if the booking has any service different from Basic Screening or not. - name: has_screening_service_business_type data_type: boolean description: | Flag to identify if the booking contains any Screening service or not. - name: has_upgraded_screening_service_business_type data_type: boolean description: | Flag to identify if the booking contains any Screening services different from Basic Screening. - name: has_deposit_management_service_business_type data_type: boolean description: | Flag to identify if the booking contains any Deposit Management service or not. - name: has_protection_service_business_type data_type: boolean description: | Flag to identify if the booking contains any Protection service or not. - name: monthly_aggregated_metrics_history_by_deal_by_time_window description: | This model aggregates monthly historic metrics for deals over different time windows. It provides insights into bookings, listings, revenue, retained revenue and additional metrics. The data is segmented by deal and time window for detailed analysis. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - date - id_deal - time_window columns: - name: date data_type: date description: | The last day of the month or yesterday for historic metrics. It's the same date as for KPIs related models. data_tests: - not_null - name: first_day_month data_type: date description: | First day of the month corresponding to the date field. data_tests: - not_null - name: id_deal data_type: character varying description: Id of the deal associated to the host. data_tests: - not_null - name: time_window data_type: character varying description: | Identifier of the time window used for the aggregation of the metrics. data_tests: - not_null - accepted_values: values: - All History - Previous 12 months - Previous 6 months - Previous 3 months - Previous month - name: client_type data_type: string description: | Type of client. It can be either PLATFORM or API. data_tests: - not_null - accepted_values: values: - PLATFORM - API - name: business_scope data_type: string description: | Business scope identifying the metric source. data_tests: - not_null - accepted_values: values: - "Old Dash" - "New Dash" - "API" - "UNSET" - name: metric_from_date data_type: date description: | The first day of the month corresponding to the lower bound range in which the metric is computed. It can be null if there's no previous history for that deal. It can vary from deal to deal depending on the number of months the deal has been active. - name: metric_to_date data_type: date description: | The first day of the month corresponding to the upper bound range in which the metric is computed. It can be null if there's no previous history for that deal. - name: main_deal_name data_type: string description: | Main name for this ID deal. data_tests: - not_null - name: has_active_pms data_type: boolean description: | Does the deal have an active associated PMS. data_tests: - not_null - name: active_pms_list data_type: string description: | Name of the active PMS associated with the deal. It can have more than one PMS associated with it. It can be null if it doesn't have any PMS associated. - 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. data_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: | ISO 3166-1 alpha-3 main country code in which the Deal is billed. In some cases it's null. - name: deal_lifecycle_state data_type: string description: | Lifecycle state of the deal. - name: deal_hubspot_stage data_type: string description: | Hubspot stage of the deal. In some cases it's null. - name: account_manager data_type: string description: | Account manager of the deal. In some cases it's null. - name: live_date_utc data_type: date description: | Date when the deal went live according to Hubspot. In some cases it's null. - name: cancellation_date_utc data_type: date description: | Date when the deal was cancelled according to Hubspot. It can be null if the deal has never churned. - name: months_between_live_and_churn data_type: integer description: | Number of months between the live date and the churn date. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: last_contacted_date_utc data_type: date description: | Date when the deal was last contacted according to Hubspot. - name: days_between_last_contacted_and_churn data_type: integer description: | Number of days between the last contacted date and the churn date. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: amount_times_contacted data_type: integer description: | Number of times the deal was contacted according to Hubspot. - name: cancellation_category data_type: text description: Categorization as to why they cancelled the account - name: cancellation_details data_type: text description: Free text with additional comments on why they cancelled the account - name: is_churning data_type: boolean description: | Flag to identify if the deal is churning or not. - name: churn_reason data_type: string description: | Reason why the deal is churning. data_tests: - accepted_values: values: - "INACTIVITY" - "ACCOUNT CANCELLATION" - name: created_bookings data_type: integer description: | Total amount of bookings created by the deal in the time window. It can be null if no bookings were created. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: listings_booked_in_month data_type: decimal description: | Average amount of listings booked in month by the deal in the time window. It can be null if no listings were booked. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: total_revenue_in_gbp data_type: decimal description: | Total revenue in GBP generated by the deal in the time window. It can be null if no revenue was generated. It can be negative. - name: revenue_retained_in_gbp data_type: decimal description: | Total revenue in GBP retained by the deal in the time window, post host takeaway waivers. It can be null if no revenue was retained. It can be negative. - name: waiver_paid_back_to_host_in_gbp data_type: decimal description: | Total amount of waivers paid back to the host in GBP in the time window. It can be null if no waivers were paid back. It's displayed as a negative value. - name: invoiced_revenue_in_gbp data_type: decimal description: | Total amount of revenue in GBP invoiced to the host in the time window. It considers both Operator revenue as well as APIs revenue. It can be null if no revenue was invoiced to the host. It can be negative. - name: guest_payments_in_gbp data_type: decimal description: | Total amount of payments in GBP made by the guest in the time window. It can be null if no payments were made by the guest. It can be negative. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: guest_revenue_retained_in_gbp data_type: decimal description: | Total amount of revenue in GBP retained by the deal from the guest in the time window, post host takeaway waivers. It can be null if no revenue was retained from the guest. It can be negative. - name: host_resolution_payment_count data_type: integer description: | Total amount of resolution payments made to the host in the time window. It can be null if no resolution payments were made by the host. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: host_resolution_amount_paid_in_gbp data_type: decimal description: | Total amount of resolution payments made to the host in GBP in the time window. It can be null if no resolution payments were made by the host. It can be negative. It's displayed as a negative value. In some extreme cases, it can be higher than 0. - name: revenue_retained_post_resolutions_in_gbp data_type: decimal description: | Total amount of revenue in GBP retained by the deal post waiver payouts and resolution payouts in the time window. It can be null if no revenue was retained post resolution payments. It can be negative, thus indicating that we are losing money. - name: edeposit_and_athena_verifications description: "This table holds records on verifications for Guesty and Edeposit bookings. It contains details on validations checked on the guests, guest information and some booking details like checkin-checkout date or the status of the verification. The id values found here are completely unrelated to the ones found in Core DWH. Note that id_verifications and booking_id should normally be 1 to 1. Though there are exception, the API will accept a duplicate booking and the users will be charged for it. A duplicate would return a unique id_verification." columns: - name: id_verification data_type: text description: "unique Superhog generated id for this verification" data_tests: - unique - not_null - name: id_booking data_type: text description: "unique Superhog generated id for a booking. note that this could be duplicated and both will be charged, it's up to the user to no generate duplicate verifications" - name: id_user_partner data_type: text description: "unique Superhog generated id for partner" data_tests: - not_null - name: id_accommodation data_type: text description: "unique Superhog generated id for a listing" - name: version data_type: text description: "value to identify if it is Guesty (V1) or E-deposit (V2)" data_tests: - accepted_values: values: - V1 - V2 - name: verification_source data_type: text description: "source of the verification for the booking" data_tests: - accepted_values: values: - Guesty - Edeposit - name: verification_status data_type: text description: "status of the verification" - name: nightly_fee_local data_type: double precision description: "fee in local currency charged per night" - name: number_nights data_type: integer description: "number of nights for the booking" - name: total_fee_local data_type: double precision description: "total fee in local currency for the booking" - name: email_flag data_type: text description: "screening result for email" - name: phone_flag data_type: text description: "screening result for phone" - name: watch_list data_type: text description: "screening result of the guest" - name: channel data_type: text description: "" - name: checkin_at_utc data_type: timestamp without time zone description: "Timestamp of checkin for the booking" - name: checkin_date_utc data_type: date description: "Date of checkin for the booking" - name: checkout_at_utc data_type: timestamp without time zone description: "Timestamp of checkout for the booking" - name: checkout_date_utc data_type: date description: "Date of checkout for the booking" - name: is_cancelled data_type: boolean description: "" - name: cancelled_at_utc data_type: timestamp without time zone description: "Timestamp of cancellation of the booking" - name: cancelled_date_utc data_type: date description: "Date of cancellation for the booking" - name: user_email data_type: text description: "" - name: guest_email data_type: text description: "" - name: guest_last_name data_type: text description: "" - name: guest_first_name data_type: text description: "" - name: guest_telephone data_type: text description: "" - name: company_name data_type: text description: "" - name: property_manager_name data_type: text description: "" - name: property_manager_email data_type: text description: "" - name: listing_name data_type: text description: "" - name: listing_address data_type: text description: "" - name: listing_town data_type: text description: "" - name: listing_country data_type: text description: "" - name: listing_postcode data_type: text description: "" - name: pets_allowed data_type: boolean description: "" - name: level_of_protection_amount data_type: integer description: "" - name: level_of_protection_currency data_type: text description: "" - name: status_updated_at_utc data_type: timestamp without time zone description: "Timestamp when status was last updated" - name: status_updated_date_utc data_type: date description: "Date of last status update of the verification" - name: updated_at_utc data_type: timestamp without time zone description: "Timestamp of last updated of the verification" - name: updated_date_utc data_type: date description: "Date of last update of the verification" - name: athena_creation_at_utc data_type: timestamp without time zone description: "Athena timestamp referring to when the booking was created. It's provided by Guesty, but is not mandatory. In case of doubt use created_at_utc or created_date_utc fields" - name: athena_creation_date_utc data_type: date description: "Athena date referring to when the booking was created. It's provided by Guesty, but is not mandatory. In case of doubt use created_at_utc or created_date_utc fields" - name: created_at_utc data_type: timestamp without time zone description: "Timestamp of creation of the verification in the system" - name: created_date_utc data_type: date description: "Date of creation of the verification in the system" - name: deals_consolidation description: | "This table contains all deal ids from different sources used in Superhog. It contains the source (Hubspot, Xero or Core), the id_deal and the name" columns: - name: id_deal data_type: character varying description: "Unique ID for this deal." data_tests: - unique - not_null - name: core_company_name data_type: character varying description: "Company name of the deal as shown in Core." - name: core_company_name_count data_type: integer description: "Count of distinct names the deal has in Core. It might be the case that a deal has ony NULL value for a name, so the count will be 0" data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: hubspot_deal_name data_type: character varying description: "Name of the deal as shown in Hubspot." - name: hubspot_deal_name_count data_type: integer description: "Count of distinct names the deal has in Hubspot. It might be the case that a deal has ony NULL value for a name, so the count will be 0" data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: xero_contact_name data_type: character varying description: "Contact name of the deal as shown in Xero." - name: xero_contact_name_count data_type: integer description: "Count of distinct names the deal has in Xero. It might be the case that a deal has ony NULL value for a name, so the count will be 0" data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: is_deal_in_core data_type: boolean description: "Flag to indicate if the deal is in Core." - name: is_deal_in_hubspot data_type: boolean description: "Flag to indicate if the deal is in Hubspot." - name: is_deal_in_xero data_type: boolean description: "Flag to indicate if the deal is in Xero." - name: ytd_mtd_aggregated_main_metrics_overview description: | This model provides a high-level overview of the main metrics for the month-to-date and financial year-to-date periods. Data is aggregated at metric level, and provides evolutions current month MTD vs. previous month EOM, current month MTD vs. previous year MTD and current YTD vs. previous YTD. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - date - dimension - dimension_value - metric_name - dbt_utils.unique_combination_of_columns: combination_of_columns: - date - dimension - dimension_value - id_metric columns: - name: date data_type: date description: The date for the month-to-date and year-to-date metrics. data_tests: - not_null - name: dimension data_type: string description: The dimension or granularity of the metrics. data_tests: - accepted_values: values: - global - name: dimension_value data_type: string description: The value or segment available for the selected dimension. data_tests: - not_null - name: first_day_month data_type: date description: The first day of the month associated with the data. data_tests: - not_null - name: calendar_year data_type: integer description: The calendar year associated with the data. data_tests: - not_null - name: financial_year data_type: integer description: The financial year associated with the data. data_tests: - not_null - name: previous_year_date data_type: date description: | The equivalent date in the previous year. It can be null if the metric is not available in the previous year - name: id_metric data_type: integer description: | Unique ID for this metric. It is preferable to use this ID when building a report to ensure changes in the metric name do not affect the report. data_tests: - not_null - name: metric_name data_type: string description: | Name of the metric. It is preferable to use the ID of the metric when building a report to ensure changes in the metric name do not affect the report. data_tests: - not_null - name: number_format data_type: string description: | Number format to display the metric in the report. data_tests: - not_null - accepted_values: values: - INTEGER - PERCENTAGE_2_DECIMALS - CURRENCY_GBP_INTEGER - CURRENCY_GBP_1_DECIMAL - name: is_latest_date data_type: integer description: | Flag to indicate if it's the latest consolidated information for this metric. Keep in mind that this can be different depending on the metric, as the invoicing cycle limits the availability of the latest data for some metrics. data_tests: - not_null - name: current_month_mtd data_type: numeric description: | Value of the metric for the current month MTD. - name: previous_month_eom data_type: numeric description: | Value of the metric for the previous month EOM. - name: previous_year_mtd data_type: numeric description: | Value of the metric for the previous year MTD. - name: current_year_ytd data_type: numeric description: | Value of the metric for the current year YTD. - name: previous_year_ytd data_type: numeric description: | Value of the metric for the previous year YTD. - name: diff_current_month_mtd_vs_previous_month_eom data_type: numeric description: | Difference between the current month MTD and the previous month EOM. - name: diff_current_month_mtd_vs_previous_year_mtd data_type: numeric description: | Difference between the current month MTD and the previous year MTD. - name: diff_current_ytd_vs_previous_ytd data_type: numeric description: | Difference between the current year YTD and the previous year YTD. - name: rel_diff_current_month_mtd_vs_previous_month_eom data_type: numeric description: | Relative difference between the current month MTD and the previous month EOM. - name: rel_diff_current_month_mtd_vs_previous_year_mtd data_type: numeric description: | Relative difference between the current month MTD and the previous year MTD. - name: rel_diff_current_ytd_vs_previous_ytd data_type: numeric description: | Relative difference between the current year YTD and the previous year YTD. - name: target_eom_value data_type: numeric description: | The EOM target value for this metric. This is the value that we aim to achieve by the end of the month. It can be null if the target is not available. - name: target_ytd_value data_type: numeric description: | The YTD target value for this metric. This is the cumulative value that we aim to achieve by the end of each month with respect to the beginning of the financial year, that will put us to reach the EOFY target. It can be null if the target is not available. - name: target_eofy_value data_type: numeric description: | The EOFY target value for this metric. This is the value that we aim to achieve by the end of the financial year. It can be null if the target is not available. - name: diff_current_month_mtd_vs_eom_target data_type: numeric description: | Difference between the current month MTD and the EOM target. It can be null if the target is not available. - name: diff_current_ytd_vs_ytd_target data_type: numeric description: | Difference between the current year YTD and the YTD target. It can be null if the target is not available. - name: diff_current_ytd_vs_eofy_target data_type: numeric description: | Difference between the current year YTD and the EOFY target. It can be null if the target is not available. - name: rel_diff_current_month_mtd_vs_eom_target data_type: numeric description: | Relative difference between the current month MTD and the EOM target. It can be null if the target is not available. - name: rel_diff_current_ytd_vs_ytd_target data_type: numeric description: | Relative difference between the current year YTD and the YTD target. It can be null if the target is not available. - name: achievement_rate_current_ytd_vs_eofy_target data_type: numeric description: | Achievement rate between the current year YTD and the EOFY target. It can be null if the target is not available. - name: rel_diff_with_sign_current_month_mtd_vs_previous_month_eom data_type: numeric description: | Relative difference between the current month MTD and the previous month EOM, with a sign to represent if the relative difference is good (positive) or bad (negative) for our business. - name: rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd data_type: numeric description: | Relative difference between the current month MTD and the previous year MTD, with a sign to represent if the relative difference is good (positive) or bad (negative) for our business. - name: rel_diff_with_sign_current_ytd_vs_previous_ytd data_type: numeric description: | Relative difference between the current year YTD and the previous year YTD, with a sign to represent if the relative difference is good (positive) or bad (negative) for our business. - name: rel_diff_with_sign_current_month_mtd_vs_eom_target data_type: numeric description: | Relative difference between the current month MTD and the EOM target, with a sign to represent if the relative difference is good (positive) or bad (negative) for our business. - name: rel_diff_with_sign_current_ytd_vs_ytd_target data_type: numeric description: | Relative difference between the current year YTD and the YTD target, with a sign to represent if the relative difference is good (positive) or bad (negative) for our business. - name: mtd_aggregated_metrics_by_deal description: | This model aggregates the historic information of our business by providing different metrics at account level (by id_deal). Additionally it provides Deal attributes. Metrics displayed in the model range for the past 24 months. Also, churned accounts are available for historical values, until 3 months after the offboarding date. Keep in mind that metrics that depend on the invoicing cycle are only available with a time delay. If you need timely information, at your own risk, check the equivalent intermediate model. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - date - metric - id_deal columns: - name: year data_type: int description: Year number of the given date. data_tests: - not_null - name: month data_type: int description: Month number of the given date. data_tests: - not_null - name: day data_type: int description: Day monthly number of the given date. data_tests: - not_null - name: is_end_of_month data_type: boolean description: Is end of month, 1 for yes, 0 for no. data_tests: - not_null - name: is_current_month data_type: boolean description: | Checks if the date is within the current executed month, 1 for yes, 0 for no. data_tests: - not_null - name: is_end_of_month_or_yesterday data_type: boolean description: | Checks if the date is end of month or yesterday, 1 for yes, 0 for no. data_tests: - not_null - name: first_day_month data_type: date description: | First day of the month corresponding to the date field. It comes from int_dates_mtd logic. data_tests: - not_null - name: date data_type: date description: | Main date for the computation, that is used for filters. It comes from int_dates_mtd logic. data_tests: - not_null - latest_date_is_yesterday - name: id_deal data_type: string description: | Unique ID for a deal, or account. data_tests: - not_null - name: deal data_type: string description: | Combination of the ID and the Name of the deal. data_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. data_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: | ISO 3166-1 alpha-3 main country code in which the Deal is billed. In some cases it's null. - name: business_scope data_type: string description: | Business scope identifying the metric source. data_tests: - not_null - accepted_values: values: - "Old Dash" - "New Dash" - "API" - "UNSET" - name: account_manager data_type: string description: | Account manager of the deal. In some cases it's null. - name: deal_lifecycle_state data_type: string description: | Lifecycle state of the deal. - name: metric data_type: text description: Name of the business metric. data_tests: - not_null - name: order_by data_type: integer description: | Order for displaying purposes. Null values are accepted, but keep in mind that then there's no default controlled display order. - name: number_format data_type: text description: Allows for grouping and formatting for displaying purposes. data_tests: - accepted_values: values: [ "integer", "percentage", "currency_gbp", "converted_metric_currency_gbp", ] - name: value data_type: numeric description: | Numeric value (integer or decimal) that corresponds to the MTD computation of the metric at a given date. Note that if the month is not in progress, then this value corresponds to the monthly figure. data_tests: - not_null - name: previous_year_value data_type: numeric description: | Numeric value (integer or decimal) that corresponds to the MTD computation of the metric on the previous year at a given date. data_tests: - not_null - name: relative_increment data_type: numeric description: | Numeric value that corresponds to the relative increment between value and previous year value, following the computation: value / previous_year_value - 1. - name: relative_increment_with_sign_format data_type: numeric description: | Relative_increment value multiplied by -1 in case this metric's growth doesn't have a positive impact for Truvi, otherwise is equal to relative_increment. This value is specially created for formatting in PBI - name: monthly_account_revenue_impact_from_growth description: | This model provides the monthly revenue impact from the growth of billable items for each deal. The revenue impact is computed as the product of the growth score and the deal contribution to the total revenue in the previous 12 months. There's 2 impact scores computed depending on the revenue metric, namely: - impact_score_total_revenue: based on Total Revenue - impact_score_revenue_retained_post_resolutions: based on Revenue Retained Post Resolutions It is important to note that if we check the ongoing month, the count of billable items and the corresponding share will be based on the projection, rather than the actual figure. In this case, the MAE and MAPE of the projected value are indicated in the model. While the growth and impact scores are computed at a monthly basis, their values will update every day with the latest available projection. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - end_date - id_deal - dbt_utils.unique_combination_of_columns: combination_of_columns: - start_date - id_deal columns: - name: start_date data_type: date description: | Start date of the period for which the revenue impact is computed. Corresponds to the first day of the month. data_tests: - not_null - name: end_date data_type: date description: | End date of the period for which the revenue impact is computed. Corresponds to the last day of the month. data_tests: - not_null - name: id_deal data_type: string description: | Unique ID for a deal, or account. data_tests: - not_null - name: deal data_type: string description: | Concatenation of the deal ID and the deal name. - name: client_type data_type: string description: | Type of the client, PLATFORM or API. - name: has_active_pms data_type: boolean description: | Flag indicating if the deal has an active PMS or not. - name: active_pms_list data_type: string description: | List of active PMS for the deal. It can be null if the deal has no active PMS. - name: main_billing_country_iso_3_per_deal data_type: string description: | Main billing country for the deal. It can be null. - name: deal_lifecycle_state data_type: string description: | Lifecycle state of the deal. - name: deal_hubspot_stage data_type: string description: | Hubspot stage of the deal. - name: account_manager data_type: string description: | Account manager of the deal. It can be null. - name: live_date_utc data_type: date description: | Live date of the deal according to HubSpot. It can be null. - name: cancellation_date_utc data_type: date description: | Cancellation date of the deal according to HubSpot. It can be null. - name: growth_score data_type: decimal description: | Growth score of the billable items, based on the average between: - The billable items of a given month vs. the average of the previous 3 months. - The share a deal has in terms of billable items of a given month if compared to the rest of the deals vs. the average of the previous 3 months. The growth score is capped between -1 and 1. It can be overridden to -1 in case the deal is cancelled in the same month. It cannot be null. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: -1 max_value: 1 strictly: false - name: impact_score_total_revenue data_type: decimal description: | Impact score of the growth score on the total revenue. It is computed as the product of the growth score and the deal contribution to the total revenue in the previous 12 months. It cannot be null. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: -1 max_value: 1 strictly: false - name: impact_score_revenue_retained_post_resolutions data_type: decimal description: | Impact score of the growth score on the revenue retained post resolutions. It is computed as the product of the growth score and the deal contribution to the revenue retained post resolutions in the previous 12 months. It cannot be null. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: -1 max_value: 1 strictly: false - name: categorisation_impact_score_revenue_retained_post_resolutions data_type: string description: | Categorisation of the impact score on the revenue retained post resolutions. It cannot be null. data_tests: - not_null - accepted_values: values: - MAJOR DECLINE - DECLINE - FLAT - GAIN - MAJOR GAIN - name: rank_impact_score_total_revenue data_type: integer description: | Monthly rank of the deal in terms of impact score on the total revenue. - name: rank_impact_score_revenue_retained_post_resolutions data_type: integer description: | Monthly rank of the deal in terms of impact score on the revenue retained post resolutions. - name: current_month_total_revenue_in_gbp data_type: decimal description: | Total revenue in GBP for the current month. If the month is in progress then this value will be null. - name: rolling_12_months_total_revenue_in_gbp data_type: decimal description: | Total revenue in GBP for the previous 12 months. It can be null. - name: share_total_revenue_rolling_12_months data_type: decimal description: | Share of the deal in terms of total revenue in the previous 12 months. It cannot be null. data_tests: - not_null - name: rank_total_revenue_rolling_12_months data_type: integer description: | Monthly rank of the deal in terms of total revenue in the previous 12 months. - name: current_month_revenue_retained_post_resolutions_in_gbp data_type: decimal description: | Revenue retained post resolutions in GBP for the current month. If the month is in progress then this value will be null. - name: rolling_12_months_revenue_retained_post_resolutions_in_gbp data_type: decimal description: | Revenue retained post resolutions in GBP for the previous 12 months. It can be null. - name: share_revenue_retained_post_resolutions_rolling_12_months data_type: decimal description: | Share of the deal in terms of revenue retained post resolutions in the previous 12 months. It cannot be null. data_tests: - not_null - name: rank_revenue_retained_post_resolutions_rolling_12_months data_type: integer description: | Monthly rank of the deal in terms of revenue retained post resolutions in the previous 12 months. - name: current_month_billable_items data_type: integer description: | Monthly billable items. If the month is in progress then this value might be projected. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: share_billable_items_current_month data_type: decimal description: | Share of the billable items for a given deal in the current month. If the month is in progress then this value might be projected. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: rank_billable_items_current_month data_type: integer description: | Monthly rank of the deal in terms of billable items in the current month. If the month is in progress then this value might be projected. - name: projection_mean_absolute_error data_type: decimal description: | Mean absolute error of the projection of the billable items. It is null if the month is not in progress or value is projected but there's no prior data to compare the projection against. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: projection_mean_absolute_percentage_error data_type: decimal description: | Mean absolute percentage error of the projection of the billable items. It is null if the month is not in progress or value is projected but there's no prior data to compare the projection against. data_tests: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: are_billable_items_projected data_type: integer description: | Flag indicating if the billable items are projected or not. If the month is in progress then this value might be projected. It can be null if there's no projection for that deal. - name: is_growth_score_overridden_due_to_cancellation data_type: integer description: | Flag indicating if the growth score is overridden to -1 due to cancellation in the same month. - name: is_ongoing_month data_type: integer description: | Flag indicating if the month is in progress or not. 1 for yes, 0 for no. - name: has_account_switched_to_major_decline data_type: integer description: | Flag indicating if the account has switched to major decline in the current month. 1 for yes, 0 for no. - name: new_dash_deal_onboarding description: | A dedicated model to track the onboarding stages of new accounts (deals) in New Dash. This excludes any deal that has been migrated from Old Dash, so it just contains "new business". columns: - name: id_deal data_type: text description: | Unique identifier of an account. data_tests: - not_null - unique - name: deal_name data_type: text description: | Name of the deal according to HubSpot. data_tests: - not_null - unique - name: deal data_type: text description: | Combination of the ID and the Name of the deal. - name: onboarding_owner data_type: text description: | Name of the person that is in charge of onboarding this account. - name: account_manager data_type: text description: | Account manager in charge of the account. - name: platform_company_name data_type: text description: | Name of the company in Truvi's backend. - name: count_platform_accounts data_type: integer description: | Amount of Backend accounts (users) linked to this Deal. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 1 max_value: 1 strictly: false - name: count_programs_at_deal_level data_type: integer description: | Total amount of programs that this account has. These might not necessarily be applied to a Listing. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: count_listings data_type: integer description: | Total count of Listings from this account. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: count_active_listings data_type: integer description: | Count of Listings that are currently active, meaning, that have not been deactivated. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_listings strictly: false - name: count_listings_with_upgraded_programs data_type: integer description: | Count of Listings that have had a program applied that contains at least one service different to Basic Screening. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_listings strictly: false - name: count_active_listings_with_active_upgraded_programs data_type: integer description: | Count of Listings that are currently active and that currently have an active upgraded program, meaning, that contains at least one service different to Basic Screening. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_active_listings strictly: false - name: count_bookings data_type: integer description: | Total count of Bookings generated from this account. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false - name: count_bookings_with_paid_service data_type: integer description: | Count of Bookings that have at least one paid service. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_bookings strictly: false - name: count_upgraded_programs_at_deal_level data_type: integer description: | Count of programs that this account has that contain, at least, one service different to Basic Screening. These might not necessarily be applied to a Listing. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_programs_at_deal_level strictly: false - name: count_upgraded_programs_at_listing_level data_type: integer description: | Count of programs that contain at least one service different to Basic Screening that have been applied to a Listing. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_upgraded_programs_at_deal_level strictly: false - name: count_active_upgraded_programs_at_active_listing_level data_type: integer description: | Count of programs that contain at least one service different to Basic Screening that are currently active and applied to an active Listing. data_tests: - not_null - dbt_expectations.expect_column_values_to_be_between: min_value: 0 max_value: count_upgraded_programs_at_listing_level strictly: false - name: contract_signed_date_utc data_type: date description: | Date in which the contract was signed according to HubSpot. data_tests: - not_null - name: contract_signed_month data_type: date description: | First day of the month in which the contract was signed according to HubSpot. data_tests: - not_null - name: live_date_utc data_type: date description: | Date in which the Deal went live according to HubSpot. - name: cancellation_date_utc data_type: date description: | Date in which the Deal was cancelled according to HubSpot. - name: backend_account_creation_utc data_type: timestamp without timezone description: | Timestamp in which the account was created in the backend. - name: first_listing_created_at_utc data_type: timestamp without timezone description: | Timestamp in which the first listing was created in the backend. - name: first_booking_created_at_utc data_type: timestamp without timezone description: | Timestamp in which the first booking was created in the backend. - name: first_program_created_at_utc data_type: timestamp without timezone description: | Timestamp in which the first program was created at account level in the backend. - name: first_upgraded_program_created_at_utc data_type: timestamp without timezone description: | Timestamp in which the first program was applied to a listing for this account, in the backend. - name: first_upgraded_program_applied_to_listing_at_utc data_type: timestamp without timezone description: | Timestamp in which the first upgraded program was applied to a listing for this account, in the backend. - name: first_booking_with_paid_services_created_at_utc data_type: timestamp without timezone description: | Timestamp in which the first booking that contained paid services was created for this account, in the backend. - name: first_invoice_at_utc data_type: timestamp without timezone description: | Timestamp in which the first invoice happened for this account in Xero. - name: expressed_service_interest data_type: text description: | List of services that during onboarding generated interest to the client. - name: services_in_programs_at_deal_level data_type: text description: | List of all distinct services that appear in programs at deal level, separated by "|" and ordered alphabetically. - name: services_in_programs_applied_to_listings data_type: text description: | List of all distinct services that are applied in all listings for this account, separated by "|" and ordered alphabetically. - name: active_services_in_programs_applied_to_listings data_type: text description: | List of all distinct services that are currently active i.e., that are applied in active listings for this account, separated by "|" and ordered alphabetically. These are the current services that can be applied to new bookings. - name: has_churned data_type: boolean description: | True if the account has a cancellation date in HubSpot, False otherwise. data_tests: - not_null - name: has_listings data_type: boolean description: | True if the account has at least one listing appearing in the backend, False otherwise. data_tests: - not_null - name: has_active_listings data_type: boolean description: | True if the account has at least one listing that is currently active in the backend, False otherwise. data_tests: - not_null - name: has_bookings data_type: boolean description: | True if the account has at least one booking appearing in the backend, False otherwise. data_tests: - not_null - name: has_been_invoiced data_type: boolean description: | True if the account has at least one invoice appearing in Xero, False otherwise. data_tests: - not_null - name: are_all_bookings_free data_type: boolean description: | True if the account has bookings but all of them are free, meaning, there's not a single service being paid. data_tests: - not_null - name: is_account_no_longer_generating_paid_bookings data_type: boolean description: | True if the account has had in the past paid bookings but at the moment there's not a single listing that contains an active upgraded program. Encouraged to be used alongside a filter to determine if the account has churned or not. data_tests: - not_null - name: has_account_changed_services_applied_in_listings data_type: boolean description: | True if the active services in programs applied to listings is different than the services that were historically applied. By nature, this always means that at least one service was being applied before that is no longer being applied. This can indicate a real decrease in services applied that could be linked to a potential revenue loss (decrease in booking fees), although it's also possible that the account has changed from a certain low-level tier to a higher-level one (ex: from Basic Protection to Protection Pro). data_tests: - not_null - name: are_active_services_different_from_expressed_interest data_type: boolean description: | True if the services that are currently applied to listings are different than the ones that were expressed as interest during onboarding. This can indicate a potential need for upselling for business teams to act upon, although it's also possible that the account has added new services that where not expressed as interest during onboarding. data_tests: - not_null