Forum Discussion
Conditionally formatting table based on slicer selection
- 4 years ago
ghoshabhijeet Apologies for the delay in response. I got the reply for the percentage data type in this post: https://community.powerbi.com/t5/Desktop/Conditionally-formatting-values-in-a-table-based-on-slicer/m-p/2557413#M904802
Marico Here is my solution. Please try this:
Create the following three measures:
Color Code EAST =
VAR PostalCode = COUNTX(train,train[Postal Code])
VAR RSales = SUMX(train,train[Sales])
RETURN
SWITCH(
TRUE(),
AND(PostalCode < 50, RSales < 10000), "Red",
"Green")
Color Code WEST =
VAR PostalCode = COUNTX(train,train[Postal Code])
VAR RSales = SUMX(train,train[Sales])
RETURN
SWITCH(
TRUE(),
AND(PostalCode < 60, RSales < 20000), "Red",
"Green")
Switch Color Codes =
IF (
SELECTEDVALUE ( RegionTable[Region] ) = "East",
[Color Code EAST],
[Color Code West]
)
After creating the above three measures,
1. Goto Format Visuals
2. Goto Cell elements
3. Select Sales under Apply Settings to
4. Select Background Color
5. Under Format Style, Select Field value
6. Under What field should we base this on?, Select Switch Color Codes measure
7. Click OK
Here is the result:
** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you ! Good Luck 👍 |
- Marico4 years agoHelper IV
Thanks for your detailed answer.
However, in the actual data the fields are of percentage data type. Could you please suggest how to modify the above measures in that case?
- ghoshabhijeet4 years agoSolution Supplier
MaricoSure, could you please share some sample data with what you are referring to as percentage data type.
** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !
Good Luck 👍
- ghoshabhijeet4 years agoSolution Supplier
Marico Could you please share some sample data with what you are referring to as percentage data type.
** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !
Good Luck 👍