Forum Discussion

EMN's avatar
EMN
Regular Visitor
1 year ago
Solved

Conditional Formatting to highlight columns with mismatched values

I have two columns of data; I'd like to apply conditional formatting to values that match and values that don't.

 

The State column is called from a table called ReportTable.

The Issue_State column is called from a table called Issues.

I'd like to set background colour to green on all matching values in both columns, and red/orange for all mismatched values.
When any columns display matching values of CLOSED or DEFERRED, I'd like to remove those rows from the table entirely.

  • Hi EMN 
    According to the colors you can use a measure like :

    color = if(SELECTEDVALUE('Issues'[State])=SELECTEDVALUE('ReportTable'[Issue_State]),"Green","Red" )
    and apply this measure for all the columns that you need 
    Result after applying for all the columns

    You can use hexa codes instead of color names :

    My recommendation from an effective visualization perspective is to highlight only what is "not correct." This approach reduces cognitive load, as red will always stand out much more against white compared to other colors. The purpose of colors is to alert where improvement is needed 🙂

    According to the filtering you can create flag measures like :

    filter =
    var state = SELECTEDVALUE('Issues'[State])
    var issue_state = SELECTEDVALUE('ReportTable'[Issue_State])
    RETURN
    if (state IN {"closed","Defered"} || issue_state  IN {"closed","Defered"} , 0,1)
    And use it as a visual filter :

    Result :

    PBIX is attached

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Hi EMN 
    According to the colors you can use a measure like :

    color = if(SELECTEDVALUE('Issues'[State])=SELECTEDVALUE('ReportTable'[Issue_State]),"Green","Red" )
    and apply this measure for all the columns that you need 
    Result after applying for all the columns

    You can use hexa codes instead of color names :

    My recommendation from an effective visualization perspective is to highlight only what is "not correct." This approach reduces cognitive load, as red will always stand out much more against white compared to other colors. The purpose of colors is to alert where improvement is needed 🙂

    According to the filtering you can create flag measures like :

    filter =
    var state = SELECTEDVALUE('Issues'[State])
    var issue_state = SELECTEDVALUE('ReportTable'[Issue_State])
    RETURN
    if (state IN {"closed","Defered"} || issue_state  IN {"closed","Defered"} , 0,1)
    And use it as a visual filter :

    Result :

    PBIX is attached

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • EMN's avatar
      EMN
      Regular Visitor

      I just realised I never said thank you! This worked perfectly, and took your advice for only showing the reds 🙂

      • Ritaf1983's avatar
        Ritaf1983
        Icon for Super User rankSuper User

        Hi EMN 

        Thank you so much for letting me know! 😊 I'm thrilled to hear that I could help you solve the issue, and even more excited that we managed to improve your visualization along the way. That's a true win-win!