Merged PR 4232: Update rule for metric depends on invoicing

# Description

Update rule for when to display metrics that depend on invoicing cycle.
Now they will show previous month values from the 20th onward of the current month

# 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.

Update rule for metric depends on invoicing

Related work items: #27180
This commit is contained in:
Joaquin Ossa 2025-01-31 08:32:35 +00:00
commit d793f610c9
4 changed files with 58 additions and 48 deletions

View file

@ -62,7 +62,8 @@ where
(
(
-- Not show current + previous month if the metric depends on invoicing
-- cycle
-- cycle and it is before the 20th of the month, if it is the 20th of
-- the month or after, only exclude the current month.
(
lower(metric) like '%total revenue%'
or lower(metric) like '%resolutions%'
@ -70,7 +71,7 @@ where
or lower(metric) like '%retained%'
or lower(metric) like '%damage host%'
)
and {{ is_date_before_previous_month("date") }}
and {{ is_date_before_20th_of_previous_month("date") }}
)
-- Keep all history for the rest of metrics
or not