Forum Discussion
Dynamic Conditional Formatting: Green text for YOY growth, Red text for YOY decline
- 4 years ago
sorry, I gave you a bad DAX measure
Try this ...
Click here to download a solutionRAG colour =
VAR myyear = SELECTEDVALUE(yourtable[Year])
VAR prevyear = myyear -1VAR myval = SUM(yourtable[Value])
VAR prevval =CALCULATE(SUM(yourtable[Value]),ALL(yourtable),yourtable[Year] = prevyear )RETURNIF( myval >= prevval, "Green", "Red")
Try this ...
add a measure ....
RAG colour =
VAR myyear = SELECTEDVALUE(yourtable[year])
VAR prevyear = myyear -1
VAR myval = SUM(yourtable[value])
VAR prevval = CALCULATE( SUM(yourtable[value]), yourtable[year]) = prevyear)
RETURN
IF( myval >= prevval, "Green", "Red)
in conditaional formating select font, format style, = Field Value, RAG colour
Please click thumbs up and accept as solution buttons for such a quick reply. Thanks 😀
It seems that I can't select a measure when I'm using Field Value. Only non-summarized columns.
- AlexisOlson4 years ago
Super User
In that case, you can have [RAG color] output 1 or 2 (instead of "Green" or "Red") and then use those to format by Rules (instead of Field value)
- afloyd21234 years agoFrequent Visitor
When I submit what is pictured I receive the error below.
MdxScript(Model) (337, 5) Calculation error in measure 'Premium'[RAG colour]: DAX comparison operations do not support comparing values of type Integer with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values.- AlexisOlson4 years ago
Super User
The error seems to indicate that [RAG color] is outputting True or False instead of 1 or 2.