Forum Discussion
Background Color on Measure (Text Field)
- 6 years ago
You can reference your measure? Are you confused because I've named my measure 'Measure' and you already have a measure called 'Measure'?
Here, try this as measure. Then select this measure BGColor in the Conditional Formatting dialogue.
BGColor = VAR col = [Measure] RETURN IF(col = "3_red", "Red", IF(col = "0_green", "Green", IF(col = "2_yellow", "Yellow", IF(col = "1_blue", "Blue", "White"))))Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Kudo's are welcome 🙂
I've recreated your table in PowerBI and created the following measure:
Measure =
VAR col = SELECTEDVALUE('Table'[Color], "Grey")
RETURN
IF(col = "3_red", "Red",
IF(col = "0_green", "Green",
IF(col = "2_yellow", "Yellow",
IF(col = "1_blue", "Blue", col))))Then I put everything in a table visual, resulting in the following table:
I was able to set the conditional formatting of any column, based on a value (of Measure, in this case):
Note: choose Field ValueResulting table
Note that the measure could be a lot easier if all your values are in the format of x_color, by taking the substring rather then a long nested IF statement. If there could be multiple numbers before the underscore, than this wouldn't work but that's another problem then 😉
Measure 2 =
VAR col = SELECTEDVALUE('Table'[Color], "0_white")
RETURN
RIGHT(col, (LEN(col)-2))
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Kudo's are welcome 🙂
JarroVGIT How do I keep my Max Measure? I understand what you are tying to do. But I need to keep that Max Measure on my Matrix then apply the color on top of it. I have a lot of companies.
- JarroVGIT6 years agoResident Rockstar
You can reference your measure? Are you confused because I've named my measure 'Measure' and you already have a measure called 'Measure'?
Here, try this as measure. Then select this measure BGColor in the Conditional Formatting dialogue.
BGColor = VAR col = [Measure] RETURN IF(col = "3_red", "Red", IF(col = "0_green", "Green", IF(col = "2_yellow", "Yellow", IF(col = "1_blue", "Blue", "White"))))Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Kudo's are welcome 🙂
- Anonymous6 years agoNot applicable
DJ I messed it up. I selected the column. THanks for help. That actually fixed my issue.