Merged PR 4578: Propagates the month attribution from invoicing data
# Description Following the changes of the month attribution on invoicing data depending if the document is posted on Xero or in Hyperline, this PR ensures that the 2 affected areas capture this change. This means: * Xero - Sales Monthly Trends * KPIs - Invoiced Revenue # 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. - [X] 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: #28158
This commit is contained in:
parent
3f1e2ea1d9
commit
1a4a9fac37
2 changed files with 16 additions and 12 deletions
|
|
@ -19,18 +19,18 @@ with
|
|||
accounting_financial_l3_aggregation, 'UNSET'
|
||||
) as accounting_financial_l3_aggregation,
|
||||
min(
|
||||
date_trunc('month', document_issued_date_utc)::date
|
||||
date_trunc('month', document_is_effective_at_end_of_month_utc)::date
|
||||
) as first_invoiced_month_utc
|
||||
from int_xero__sales_denom_mart
|
||||
where document_issued_date_utc is not null
|
||||
where document_is_effective_at_end_of_month_utc is not null
|
||||
group by 1, 2, 3, 4, 5, 6
|
||||
),
|
||||
unique_months as (
|
||||
select distinct
|
||||
date_trunc('month', document_issued_date_utc)::date
|
||||
date_trunc('month', document_is_effective_at_end_of_month_utc)::date
|
||||
as document_issued_month_utc
|
||||
from int_xero__sales_denom_mart
|
||||
where document_issued_date_utc is not null
|
||||
where document_is_effective_at_end_of_month_utc is not null
|
||||
),
|
||||
category_skeleton as (
|
||||
select distinct
|
||||
|
|
@ -59,7 +59,7 @@ with
|
|||
),
|
||||
aggregated_amount_wo_taxes_in_gbp as (
|
||||
select
|
||||
date_trunc('month', document_issued_date_utc)::date
|
||||
date_trunc('month', document_is_effective_at_end_of_month_utc)::date
|
||||
as document_issued_month_utc,
|
||||
coalesce(document_status, 'UNSET') as document_status,
|
||||
coalesce(document_type, 'UNSET') as document_type,
|
||||
|
|
@ -75,7 +75,7 @@ with
|
|||
) as accounting_financial_l3_aggregation,
|
||||
sum(line_amount_wo_taxes_in_gbp) as amount_wo_taxes_in_gbp
|
||||
from int_xero__sales_denom_mart
|
||||
where document_issued_date_utc is not null
|
||||
where document_is_effective_at_end_of_month_utc is not null
|
||||
group by 1, 2, 3, 4, 5, 6, 7
|
||||
),
|
||||
monthly_data_with_lag as (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue