Forum Discussion
mf5333
1 year agoRegular Visitor
Conditional formatting based on previous 'filtered column' in Matrix.
There are a couple of questions and answers regarding the question to apply conditional formatting based on the previous year/month column in a matrix visual. but i have a different requirement. ...
Anonymous
1 year agoNot applicable
Hi mf5333 ,
Try creating two metrics, one to find the difference between 2020 and 2022 and the other to use as a conditional judgment. Refer to a formula similar to the following:
Difference =
VAR SelectedYears =
VALUES ( 'Sales'[Year] )
VAR Year2020 =
CALCULATE ( SUM ( 'Sales'[Value] ), 'Sales'[Year] = 2020 )
VAR Year2022 =
CALCULATE ( SUM ( 'Sales'[Value] ), 'Sales'[Year] = 2022 )
RETURN
IF (
2022
IN SelectedYears
&& 2020 IN SelectedYears,
Year2022 - Year2020,
BLANK ()
)
Color =
IF([Difference] > 0, "Green", IF([Difference] < 0, "Red", "Yellow"))
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.