Forum Discussion

bman6074's avatar
bman6074
Icon for Helper I rankHelper I
7 years ago
Solved

Conditional Formatting not working for all words in the column

I built a DAX to color wrods with int a matrix under "Values". When I setup the condition it colors some but not all. See screenshot. You see some background are colored and not colored even though its same words. It appears to work for some but not all. Why would this be? How can I fix?

 

Dax code 

Usage Risk Colors =
VAR Usage_Risk = SELECTEDVALUE('Key Table'[Usage_Risk])
RETURN
SWITCH(TRUE(),
Usage_Risk = "Unsupported/Not Allowed", "#E01920",
Usage_Risk = "Sunset", "#FAB131",
Usage_Risk = "Limited Use", "#FF5A00",
Usage_Risk = "preferred", "#7BBA00"
)

  • I was able to resolve this problem by changing the visualization to a Table instead of a Matrix

9 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi bman6074 

     

    Change 

    VAR Usage_Risk = SELECTEDVALUE('Key Table'[Usage_Risk])

    to 

    VAR Usage_Risk = MAX('Key Table'[Usage_Risk])

    And see if that makes a difference

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • bman6074's avatar
      bman6074
      Icon for Helper I rankHelper I

      It makes a difference but not the right colors

      • Mariusz's avatar
        Mariusz
        Icon for Community Champion rankCommunity Champion

        Hi bman6074 

         

        SELECTEDVALUE was returning a second argument ( optional if multiple values occur ) witch in you case was not assigned and that's the reason for no color, now MAX is returning max value that obviously is not the one displayed in your table.

         

        Is Usage risk in the screenshot table a Column or Measure?

         

        Best Regards,
        Mariusz

        If this post helps, then please consider Accepting it as the solution.

        Please feel free to connect with me.
        Mariusz Repczynski