Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Conditional Formatting not working correctly

Hello community! 

i am trying to use conditional formatting on a table. 

I have used background colour based on a field. 

The field is a DAX with Switch condition. 

Unfortunately the results seems to work but is not accurate. As you can see on my print screen, some colours are not accurate. For example 47% should be an orange colour but turns out to be red and so on and so forth. 

The Dax is working correctly as it is presented at the end of the slide. 

Thank you very much 

3 Replies

  • Anonymous , Need to check the measure you have used are you getting consistent value from that. One on the right hand side. I do not see a static value of .44.

     

    Make sure measure on right is using all or allselected

     

    can you share the measure formula

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    • Anonymous's avatar
      Anonymous
      Not applicable

      The Dax of the measure is as follows: 

      Image Performance TOP 3% = (CALCULATE(COUNT('E9 Image Attributes'[Response ID]),'E9 Image Attributes'[Value] =10 || 'E9 Image Attributes'[Value] =9 || 'E9 Image Attributes'[Value] =8 ))/[Total Sample]
  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for having a look on this... 

    DAX to define colour is here: 

    Background colour Image = SWITCH(
    TRUE(),
    [Image Performance TOP 3%]<= [Image Average across brands-attributes]*0.85,"#C00000",
    [Image Performance TOP 3%]>= [Image Average across brands-attributes]*1.15,"#027123",
    "#E66C37"
    )
     DAX included in the SWITCH dax is as below: 
    Image Average across brands-attributes = CALCULATE((CALCULATE(COUNT('E9 Image Attributes'[Response ID]),'E9 Image Attributes'[Value]=10 || 'E9 Image Attributes'[Value]= 9 || 'E9 Image Attributes'[Value] = 8))/([Total Sample]*DISTINCTCOUNT('Brands per Study'[Brand])*DISTINCTCOUNT('E9 Image Attributes'[Attribute])), ALL('Brands per Study'[Brand]),ALL('E9 Image Attributes'[Attribute]))
     
    So .44 is the output of this DAX (Image Average across brands-attributes ) * 85% 
     
    The conditional formating works fine when you are using the SWITCH with a constant number, but when you need to make this variable according to the above dax it creates descrepancies.