Forum Discussion

afloyd2123's avatar
afloyd2123
Frequent Visitor
4 years ago
Solved

Dynamic Conditional Formatting: Green text for YOY growth, Red text for YOY decline

Hi team, I'd like to use dynamic conditional formatting to show green text for YOY (year over year) growth and red text for a YOY decrease.  For example: 2022 Total Department is less than it was i...
  • speedramps's avatar
    4 years ago

    sorry, I gave you a bad DAX measure

     

    Try this ...

     Click here to download a solution 

     

     

    RAG colour =

    VAR myyear = SELECTEDVALUE(yourtable[Year])

    VAR prevyear = myyear -1
    VAR myval = SUM(yourtable[Value])

    VAR prevval =
    CALCULATE(
    SUM(yourtable[Value]),
    ALL(yourtable),
    yourtable[Year] = prevyear )
    RETURN
    IF( myval >= prevval, "Green", "Red")