Merged PR 4500: Revert "Relative increments with sign"

# Description

_Describe your motivation and changes here._

# Checklist

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

# Other

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

Revert "Relative increments with sign"

Reverted commit `f5718ded`.
This commit is contained in:
Oriol Roqué Paniagua 2025-02-25 11:43:05 +00:00
parent f5718ded4d
commit 5eebb4f560
4 changed files with 27 additions and 159 deletions

View file

@ -8,7 +8,6 @@
"current_YTD": "current_ytd_total_revenue_in_gbp", "current_YTD": "current_ytd_total_revenue_in_gbp",
"previous_YTD": "previous_ytd_total_revenue_in_gbp", "previous_YTD": "previous_ytd_total_revenue_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 2, "id_metric": 2,
@ -19,7 +18,6 @@
"current_YTD": "current_ytd_revenue_retained_post_resolutions_in_gbp", "current_YTD": "current_ytd_revenue_retained_post_resolutions_in_gbp",
"previous_YTD": "previous_ytd_revenue_retained_post_resolutions_in_gbp", "previous_YTD": "previous_ytd_revenue_retained_post_resolutions_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 3, "id_metric": 3,
@ -30,7 +28,6 @@
"current_YTD": "current_ytd_total_guest_payments_in_gbp", "current_YTD": "current_ytd_total_guest_payments_in_gbp",
"previous_YTD": "previous_ytd_total_guest_payments_in_gbp", "previous_YTD": "previous_ytd_total_guest_payments_in_gbp",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 4, "id_metric": 4,
@ -41,7 +38,6 @@
"current_YTD": "current_ytd_xero_operator_net_fees_in_gbp", "current_YTD": "current_ytd_xero_operator_net_fees_in_gbp",
"previous_YTD": "previous_ytd_xero_operator_net_fees_in_gbp", "previous_YTD": "previous_ytd_xero_operator_net_fees_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 5, "id_metric": 5,
@ -52,7 +48,6 @@
"current_YTD": "current_ytd_xero_apis_net_fees_in_gbp", "current_YTD": "current_ytd_xero_apis_net_fees_in_gbp",
"previous_YTD": "previous_ytd_xero_apis_net_fees_in_gbp", "previous_YTD": "previous_ytd_xero_apis_net_fees_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 6, "id_metric": 6,
@ -63,7 +58,6 @@
"current_YTD": "current_ytd_billable_bookings", "current_YTD": "current_ytd_billable_bookings",
"previous_YTD": "previous_ytd_billable_bookings", "previous_YTD": "previous_ytd_billable_bookings",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 7, "id_metric": 7,
@ -74,7 +68,6 @@
"current_YTD": "current_ytd_live_deals", "current_YTD": "current_ytd_live_deals",
"previous_YTD": "previous_ytd_live_deals", "previous_YTD": "previous_ytd_live_deals",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 8, "id_metric": 8,
@ -85,7 +78,6 @@
"current_YTD": "current_ytd_new_deals", "current_YTD": "current_ytd_new_deals",
"previous_YTD": "previous_ytd_new_deals", "previous_YTD": "previous_ytd_new_deals",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 9, "id_metric": 9,
@ -96,7 +88,6 @@
"current_YTD": "current_ytd_churning_deals", "current_YTD": "current_ytd_churning_deals",
"previous_YTD": "previous_ytd_churning_deals", "previous_YTD": "previous_ytd_churning_deals",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 10, "id_metric": 10,
@ -107,7 +98,6 @@
"current_YTD": "current_ytd_waiver_payout_rate", "current_YTD": "current_ytd_waiver_payout_rate",
"previous_YTD": "previous_ytd_waiver_payout_rate", "previous_YTD": "previous_ytd_waiver_payout_rate",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 11, "id_metric": 11,
@ -118,7 +108,6 @@
"current_YTD": "current_ytd_resolutions_payout_rate", "current_YTD": "current_ytd_resolutions_payout_rate",
"previous_YTD": "previous_ytd_resolutions_payout_rate", "previous_YTD": "previous_ytd_resolutions_payout_rate",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 12, "id_metric": 12,
@ -129,7 +118,6 @@
"current_YTD": "current_ytd_operator_revenue_per_billable_booking", "current_YTD": "current_ytd_operator_revenue_per_billable_booking",
"previous_YTD": "previous_ytd_operator_revenue_per_billable_booking", "previous_YTD": "previous_ytd_operator_revenue_per_billable_booking",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 13, "id_metric": 13,
@ -140,7 +128,6 @@
"current_YTD": "current_ytd_waiver_revenue_per_billable_booking", "current_YTD": "current_ytd_waiver_revenue_per_billable_booking",
"previous_YTD": "previous_ytd_waiver_revenue_per_billable_booking", "previous_YTD": "previous_ytd_waiver_revenue_per_billable_booking",
"display_exclusion": "NONE", "display_exclusion": "NONE",
"increment_sign_format": "POSITIVE",
}, },
{ {
"id_metric": 14, "id_metric": 14,
@ -151,7 +138,6 @@
"current_YTD": "-1*current_ytd_xero_waiver_paid_back_to_host_in_gbp", "current_YTD": "-1*current_ytd_xero_waiver_paid_back_to_host_in_gbp",
"previous_YTD": "-1*previous_ytd_xero_waiver_paid_back_to_host_in_gbp", "previous_YTD": "-1*previous_ytd_xero_waiver_paid_back_to_host_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 15, "id_metric": 15,
@ -162,7 +148,6 @@
"current_YTD": "-1*current_ytd_xero_host_resolution_amount_paid_in_gbp", "current_YTD": "-1*current_ytd_xero_host_resolution_amount_paid_in_gbp",
"previous_YTD": "-1*previous_ytd_xero_host_resolution_amount_paid_in_gbp", "previous_YTD": "-1*previous_ytd_xero_host_resolution_amount_paid_in_gbp",
"display_exclusion": "INVOICING", "display_exclusion": "INVOICING",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 16, "id_metric": 16,
@ -173,7 +158,6 @@
"current_YTD": "current_ytd_total_revenue_churn_rate", "current_YTD": "current_ytd_total_revenue_churn_rate",
"previous_YTD": "previous_ytd_total_revenue_churn_rate", "previous_YTD": "previous_ytd_total_revenue_churn_rate",
"display_exclusion": "ONGOING_MONTH", "display_exclusion": "ONGOING_MONTH",
"increment_sign_format": "NEGATIVE",
}, },
{ {
"id_metric": 17, "id_metric": 17,
@ -184,7 +168,6 @@
"current_YTD": "current_ytd_onboarding_mrr", "current_YTD": "current_ytd_onboarding_mrr",
"previous_YTD": "previous_ytd_onboarding_mrr", "previous_YTD": "previous_ytd_onboarding_mrr",
"display_exclusion": "ONGOING_MONTH", "display_exclusion": "ONGOING_MONTH",
"increment_sign_format": "POSITIVE",
}, },
] %} ] %}
with with
@ -207,7 +190,6 @@ with
-- quotation marks added because text format -- quotation marks added because text format
'{{ metric.name }}' as metric_name, '{{ metric.name }}' as metric_name,
'{{ metric.display_exclusion }}' as display_exclusion, '{{ metric.display_exclusion }}' as display_exclusion,
'{{ metric.increment_sign_format }}' as increment_sign_format,
{{ metric.current_month_MTD }} as current_month_mtd, {{ metric.current_month_MTD }} as current_month_mtd,
{{ metric.previous_month_EOM }} as previous_month_eom, {{ metric.previous_month_EOM }} as previous_month_eom,
{{ metric.previous_year_MTD }} as previous_year_mtd, {{ metric.previous_year_MTD }} as previous_year_mtd,
@ -234,9 +216,8 @@ with
union all union all
{% endif %} {% endif %}
{% endfor %} {% endfor %}
), )
metrics_with_targets as ( select
select
metrics.*, metrics.*,
-- EOM target -- -- EOM target --
targets.target_eom_value as target_eom_value, targets.target_eom_value as target_eom_value,
@ -257,40 +238,8 @@ with
metrics.current_year_ytd / nullif( metrics.current_year_ytd / nullif(
targets.target_eofy_value, 0 targets.target_eofy_value, 0
) as achievement_rate_current_ytd_vs_eofy_target ) as achievement_rate_current_ytd_vs_eofy_target
from main_metrics_aggregation as metrics from main_metrics_aggregation as metrics
left join left join
stg_seed__main_metrics_targets as targets stg_seed__main_metrics_targets as targets
on metrics.id_metric = targets.id_metric on metrics.id_metric = targets.id_metric
and date_trunc('month', metrics.date) and date_trunc('month', metrics.date) = date_trunc('month', targets.target_date)
= date_trunc('month', targets.target_date)
)
select
metrics_with_targets.*,
-- Add sign to relative differences --
case
when increment_sign_format = 'NEGATIVE'
then rel_diff_current_month_mtd_vs_previous_month_eom * -1
else rel_diff_current_month_mtd_vs_previous_month_eom
end as rel_diff_with_sign_current_month_mtd_vs_previous_month_eom,
case
when increment_sign_format = 'NEGATIVE'
then rel_diff_current_month_mtd_vs_previous_year_mtd * -1
else rel_diff_current_month_mtd_vs_previous_year_mtd
end as rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd,
case
when increment_sign_format = 'NEGATIVE'
then rel_diff_current_ytd_vs_previous_ytd * -1
else rel_diff_current_ytd_vs_previous_ytd
end as rel_diff_with_sign_current_ytd_vs_previous_ytd,
case
when increment_sign_format = 'NEGATIVE'
then rel_diff_current_month_mtd_vs_eom_target * -1
else rel_diff_current_month_mtd_vs_eom_target
end as rel_diff_with_sign_current_month_mtd_vs_eom_target,
case
when increment_sign_format = 'NEGATIVE'
then rel_diff_current_ytd_vs_ytd_target * -1
else rel_diff_current_ytd_vs_ytd_target
end as rel_diff_with_sign_current_ytd_vs_ytd_target
from metrics_with_targets

View file

@ -2664,38 +2664,3 @@ models:
description: | description: |
Achievement rate between the current year YTD and the EOFY target. It can be null Achievement rate between the current year YTD and the EOFY target. It can be null
if the target is not available. 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.

View file

@ -2131,38 +2131,3 @@ models:
description: | description: |
Achievement rate between the current year YTD and the EOFY target. It can be null Achievement rate between the current year YTD and the EOFY target. It can be null
if the target is not available. 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.

View file

@ -3,8 +3,7 @@ with
select * from {{ ref("int_ytd_mtd_aggregated_main_metrics_overview") }} select * from {{ ref("int_ytd_mtd_aggregated_main_metrics_overview") }}
), ),
latest_dates_per_financial_year as ( latest_dates_per_financial_year as (
select select dimension, financial_year, id_metric, max(date) as latest_available_date
dimension, financial_year, id_metric, max(m.date) as latest_available_date
from int_ytd_mtd_aggregated_main_metrics_overview m from int_ytd_mtd_aggregated_main_metrics_overview m
where where
( (
@ -64,17 +63,7 @@ select
m.target_eofy_value as target_eofy_value, m.target_eofy_value as target_eofy_value,
m.diff_current_ytd_vs_eofy_target as diff_current_ytd_vs_eofy_target, m.diff_current_ytd_vs_eofy_target as diff_current_ytd_vs_eofy_target,
m.achievement_rate_current_ytd_vs_eofy_target m.achievement_rate_current_ytd_vs_eofy_target
as achievement_rate_current_ytd_vs_eofy_target, as achievement_rate_current_ytd_vs_eofy_target
m.rel_diff_with_sign_current_month_mtd_vs_previous_month_eom
as rel_diff_with_sign_current_month_mtd_vs_previous_month_eom,
m.rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd
as rel_diff_with_sign_current_month_mtd_vs_previous_year_mtd,
m.rel_diff_with_sign_current_ytd_vs_previous_ytd
as rel_diff_with_sign_current_ytd_vs_previous_ytd,
m.rel_diff_with_sign_current_month_mtd_vs_eom_target
as rel_diff_with_sign_current_month_mtd_vs_eom_target,
m.rel_diff_with_sign_current_ytd_vs_ytd_target
as rel_diff_with_sign_current_ytd_vs_ytd_target
from int_ytd_mtd_aggregated_main_metrics_overview m from int_ytd_mtd_aggregated_main_metrics_overview m
inner join inner join
latest_dates_per_financial_year ld latest_dates_per_financial_year ld