Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mgrapsa
New Member

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 

conditional formating_LI.jpgconditional formating2.PNG

conditional formatting 3.PNG

3 REPLIES 3
mgrapsa
New Member

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. 
amitchandak
Super User
Super User

@mgrapsa , 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.

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]

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.