Forum Discussion
Conditional color by product
Hi, how to create a measure to have the below color criteria?
If the Product = Product A & [Average hours] > 30 then "red", if Product = Product B & [Average hours] > 25, "Red", else "Green"
- Anonymous5 years ago
Hi Anonymous ,
Please try the measure below:
Color Criteria = SWITCH( TRUE(), SELECTEDVALUE( 'Table'[Product] ) = "A" &&SELECTEDVALUE('Table'[Average hours])> 30, "red", SELECTEDVALUE( 'Table'[Product] ) = "B" &&SELECTEDVALUE('Table'[Average hours])> 25,"red","green" )Then you can follow these steps to set font color.
1.Click the column you want to apply the conditional color.
2.Under the “Format by” options >choose Field value>
3.Choose Color Criteria in "Based on field" pane and click ok.
You will get a chart like below:
A sample PBIX. for your reference is attached
Hope it helps,
Community Support Team _ Caitlyn Yan
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- selimovd
Most Valuable Professional
Hey Anonymous ,
you can do that with the following measure:
Color Criteria = SWITCH( TRUE(), MAX( myTable[Product] ) = "Product A" & [Average hours] > 30, "red", MAX( myTable[Product] ) = "Product B" & [Average hours] > 25, "red", "Green" )If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic - AnonymousNot applicable
Hi Anonymous ,
Please try the measure below:
Color Criteria = SWITCH( TRUE(), SELECTEDVALUE( 'Table'[Product] ) = "A" &&SELECTEDVALUE('Table'[Average hours])> 30, "red", SELECTEDVALUE( 'Table'[Product] ) = "B" &&SELECTEDVALUE('Table'[Average hours])> 25,"red","green" )Then you can follow these steps to set font color.
1.Click the column you want to apply the conditional color.
2.Under the “Format by” options >choose Field value>
3.Choose Color Criteria in "Based on field" pane and click ok.
You will get a chart like below:
A sample PBIX. for your reference is attached
Hope it helps,
Community Support Team _ Caitlyn Yan
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.