Forum Discussion
Anonymous
8 years agoNot applicable
Color coding with DAX
With the latest Desktop release we got some color coding possibilities with DAX. https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-formatting-by-field-value ...
- 4 years ago
Hi,
This happens to me all the time. And everytime it's because I forgot the change the type of the measure that returns the color codes. It defaults to "number" even when your formula returns a text. You have to force it to "text". Then it wont be disable/gray-out anymore in the field pick-list.
--mo
Seward12533
Solution Sage
8 years agoYour Measure Calue is TEXT Has to be numeric. Try wrapping the Measure Value within your SWITCH of your color measure with a VALUE() to concert to a number.
- Anonymous8 years agoNot applicable
Thanks Seward
If I wrap SWITCH () in Value() like this:
Measure Value = var MySelection = SELECTEDVALUE('Measures 1'[MEASURE ID]) return VALUE( SWITCH( TRUE(); MySelection = 1;FORMAT([VALUE SHARE];"0.0%"); MySelection = 2;FORMAT([VALUE SHARE DYA];"0.0%"); MySelection = 3;FORMAT([VALUE SALES IYA];"0"); MySelection = 4;FORMAT([VOLUME SALES IYA];"0"); MySelection = 5;FORMAT([$/SU IYA];"0"); BLANK() ) )I am getting an error:
- Seward125338 years ago
Solution Sage
No like this.
Measure Value Color = SWITCH(TRUE();
VALUE([Measure Value]) <=1;"#000000";- Anonymous8 years agoNot applicable
Measure Value Color = SWITCH(TRUE(); VALUE([Measure Value]) <=1;"#000000"; VALUE([Measure Value]) <99,5;"#e60000"; VALUE([Measure Value]) <100,5;"#000000"; VALUE([Measure Value]) <999999;"#2d862d" )Thanks Seward, but it doesnt change anything. Still the same error