Forum Discussion
nbrandborg
4 years agoHelper II
Divide based on multiple conditions
Hi all I struggle to do a YoY comparison based on some criterias I only need the % comparison to happen between month 1 and 12 as the months are rolling- Month 4 and 8 are irrelevant. I have a d...
- 4 years ago
With this model, containing dimension tables for country and month,
and this measure (with a simple SUM base measure for the ratio):
YoY % Change measure = VAR _1 = CALCULATE ( [Sum Ratio], 'Dim Month'[dMonth] = 1, ALLEXCEPT ( FactTable, 'Dim COuntry'[dCountry] ) ) VAR _12 = CALCULATE ( [Sum Ratio], 'Dim Month'[dMonth] = 12, ALLEXCEPT ( FactTable, 'Dim COuntry'[dCountry] ) ) RETURN DIVIDE ( _12, _1 ) - 1I've attached the sample PBIX file
PaulDBrown
4 years agoCommunity Champion
With this model, containing dimension tables for country and month,
and this measure (with a simple SUM base measure for the ratio):
YoY % Change measure =
VAR _1 =
CALCULATE (
[Sum Ratio],
'Dim Month'[dMonth] = 1,
ALLEXCEPT ( FactTable, 'Dim COuntry'[dCountry] )
)
VAR _12 =
CALCULATE (
[Sum Ratio],
'Dim Month'[dMonth] = 12,
ALLEXCEPT ( FactTable, 'Dim COuntry'[dCountry] )
)
RETURN
DIVIDE ( _12, _1 ) - 1
I've attached the sample PBIX file
nbrandborg
4 years agoHelper II
That was a very clever solution! Thank you. It works.