Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Top 3 Conditional Formatting Bar Chart

Hi,

Here's two measures that are used to highlight the top 3 responses in the bar chart below. The measure works but it's including values outside the top 3 (highlighted in "green"). How do I fix this? Appreciate any tips please.

Top 3 Reasons For Leaving = 
VAR CurrentReason = SELECTEDVALUE('Survey Exit Data'[Q7: What is the main reason you decided to leave?])
VAR TopReasons = TOPN(3, ALL('Survey Exit Data'[Q7: What is the main reason you decided to leave?]), [Total Completions], DESC)
RETURN
IF(
    CurrentReason IN TopReasons,
    1,
    0
)
Top 3 Reasons Leaving CF = 
IF([Top 3 Reasons For Leaving] = 1, "#D5E6A5", "#54B9AD")

 

  • hi Anonymous 

     

    Figured the problem. If you set the color manually for any specific category and then select "All" and try to use formula, it will not override the colors you set manually. I don't know how to clear manual color selection. Try creating a new chat and don't select any colors manually.

     

     

6 Replies

  • talespin's avatar
    talespin
    Solution Sage

    hi Anonymous ,

     

    There is nothing wrong with DAX. The color is coming from somewhere else. I changed the color to red/blue.

    Also I created another visual and works perfectly fine with the measures you shared. I am not able to figure out the reason for problematic columns. 

     

     

    • talespin's avatar
      talespin
      Solution Sage

      hi Anonymous 

       

      Figured the problem. If you set the color manually for any specific category and then select "All" and try to use formula, it will not override the colors you set manually. I don't know how to clear manual color selection. Try creating a new chat and don't select any colors manually.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        talespin it worked after creating a new visual. At least I know it had nothing to do with the measure. Thank you so much for clarifying, appreciate it.

  • talespin's avatar
    talespin
    Solution Sage

    Hi Anonymous 

     

    If possible please share pbix file will any sensitive data removed.