Forum Discussion
How to Assign Hex Code Based On Measure Value
- 4 years ago
Hi Anonymous
Try this:
Colour1 = SWITCH ( TRUE (), [Total Sales Variance Percent] > 0, 1, [Total Sales Variance Percent] < 0, 2, BLANK () )Then define color1=1-> #41AC4C and if color1=2 -> #E42925
or use this:
Colour1 = SWITCH ( TRUE (), [Total Sales Variance Percent] > 0, #41AC4C, [Total Sales Variance Percent] < 0, #E42925, BLANK () )If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Anonymous can yiu try this
Colour1 = VAR MySelection = SELECTEDMEASURE()
RETURN SWITCH( [Total Sales Variance Percent],
MySelection > 0, 1,
MySelection < 0, 2,
BLANK())
In card background color you can mention if color1=1, #41AC4C, if color1=2,#E42925
- Anonymous4 years agoNot applicable
Hello smpa01 ,
So the measure seems to work fine but still can't display visual.
As soon as I colour format, the display card shows the error message along with "Function: SWITCH does not support comparing values of type Text with values of type True/False." However, [Total Sales Variance Percent] is formatted as a Percentage.
Thanks again for your help!