The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Color measure =
VAR Team =
SELECTEDVALUE ( Team[Name] )
RETURN
SWITCH (
TRUE (),
Team = "South"
&& 'Measures'[Work Total] >= 0
&& Measures'[Work Total] < 18, "#09D543",
-- Green
Team = "South,"
&& Measures'[Work Total] >= 18
&& Measures'[Work Total] < 36, "#FFA500",
-- Orange
Team = "South"
&& Measures'[Work Total] >= 36, "#FF0000",
-- Red
Team = "North"
&& Measures'[Work Total] >= 0
&& Measures'[Work Total] < 10, "#09D543",
-- Green
Team = "North"
&& Measures'[Work Total] >= 10
&& Measures'[Work Total] < 20, "#FFA500",
-- Orange
Team = "North"
&& Measures'[Work Total] >= 20, "#FF0000",
-- Red
Team = "West"
&& Measures'[Work Total] >= 0
&& Measures'[Work Total] <= 10, "#09D543",
-- Green
Team = "West"
&& Measures'[Work Total] > 10
&& Measures'[Work Total] <= 20, "#FFA500",
-- Orange
Team = "West"
&& Measures'[Work Total] > 20, "#FF0000",
-- Red
Team = "East"
&& Measures'[Work Total] >= 0
&& Measures'[Work Total] <= 10, "#09D543",
-- Green
Team = "East"
&& Measures'[Work Total] > 10
&& Measures'[Work Total] <= 20, "#FFA500",
-- Orange
Team = "East"
&& Measures'[Work Total] > 20, "#FF0000",
-- Red
Team = "Central"
&& Measures'[Work Total] >= 0
&& Measures'[Work Total] <= 10, "#09D543",
-- Green
Team = "Central"
&& Measures'[Work Total] > 10
&& Measures'[Work Total] <= 20, "#FFA500",
-- Orange
Team = "Central"
&& Measures'[Work Total] > 20, "#FF0000",
-- Red
BLANK () -- Default case
)
Team | Week 32 | Week 33 |
North | 5 | 9 |
East | 21 | 34 |
South | 9 | 12 |
West | 35 | 41 |
Central | 200 | 150 |
Solved! Go to Solution.
@dataforlife I'm confident that is a data quality issue. Please perform trim and clean steps in PQ and then check. If it still doesn't work, please share a sample pbix file, and remove sensitive information before sharing.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@dataforlife I'm confident that is a data quality issue. Please perform trim and clean steps in PQ and then check. If it still doesn't work, please share a sample pbix file, and remove sensitive information before sharing.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
You're right, I tried my dax function in a test table and it works. I'll have to see what goes wrong in the column "team'' and I'll try the clean and trim.
@dataforlife one another reason could be that team name has some non printable characters that are not visible and the comparison is not happening. Just guessing, may be clean and trim the team name column data in PQ to clear all spaces and non printable characters. Again this is just a wild guess.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@dataforlife if you put the measure in a table visual with team[name] column, do you see "green" or "Red" color.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
No, it does not color any of the fields. I tried
Measure Teamcolor = if(SELECTEDVALUE(Team[Name]) = "South", "Green", "Red")
just to check whether it will color any of the rows that belong to Team south, but it does not do it.
Hello. I am new here and by no means an expert. But you can conditionally format values following the prompts in the screen shot below. Right click the measure from the matrix> conditional formatting>background color> and edit the rules. You can enter <,>,=, is, start with, etc as the rule and edit the hex code for each value.
Hope this helps.
@dataforlife it should work, just to make sure, the column for Team you are using on the rows is the one you are checking in the measure, I'm sure that is the case but just double checking.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I tried debugging whether it is able to find the team and color, but it does not seem to work. It simply does not do anything. Do you have an idea why? The dax function does not color any field.
Example code:
Measure Teamcolor = if(SELECTEDVALUE(Team[Name]) = "South", "Green", "Red")
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
78 | |
66 | |
52 | |
50 |
User | Count |
---|---|
121 | |
118 | |
77 | |
64 | |
63 |