Forum Discussion
Anonymous
4 years agoNot applicable
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 seem...
Anonymous
4 years agoNot 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.