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:
parent
4076f016bd
commit
f5311fa954
9 changed files with 947 additions and 13 deletions
|
|
@ -16,7 +16,7 @@ select distinct
|
|||
d.month_start_date as first_day_month,
|
||||
d.month_end_date as last_day_month
|
||||
from int_core__unified_user u
|
||||
inner join int_dates d on d.date_day >= u.created_date_utc
|
||||
inner join int_dates d on d.date_day >= date(u.created_date_utc)
|
||||
inner join int_core__deal deal on deal.id_deal = u.id_deal
|
||||
where
|
||||
-- include only up-to yesterday
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{% set dimensions = get_kpi_dimensions() %}
|
||||
|
||||
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||
|
|
@ -7,9 +6,7 @@ with
|
|||
int_core__mtd_accommodation_segmentation as (
|
||||
select * from {{ ref("int_core__mtd_accommodation_segmentation") }}
|
||||
),
|
||||
int_core__user_host as (
|
||||
select * from {{ ref("int_core__user_host") }}
|
||||
),
|
||||
int_core__user_host as (select * from {{ ref("int_core__user_host") }}),
|
||||
int_dates_mtd as (select * from {{ ref("int_dates_mtd") }})
|
||||
|
||||
{% for dimension in dimensions %}
|
||||
|
|
@ -26,13 +23,13 @@ with
|
|||
d.is_current_month
|
||||
from int_dates_mtd d
|
||||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__mtd_accommodation_segmentation a
|
||||
on d.date = a.date
|
||||
inner join int_core__mtd_accommodation_segmentation a on d.date = a.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host h
|
||||
on d.date >= h.created_date_utc
|
||||
and h.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
inner join
|
||||
int_core__user_host h
|
||||
on d.date >= date(h.created_date_utc)
|
||||
and h.main_billing_country_iso_3_per_deal is not null
|
||||
{% endif %}
|
||||
{% if not loop.last %}
|
||||
union all
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue