Forum Discussion
Conditional Formatting for Color in Bar Chart
Hi lkalawski,
Yes, exactly what you said. I want to draw a bar graph of number of product with color indication based on network. The amount number of product here doesn't really matter. You can put any number for each product.
Anonymous
You can create a measure which will indicate which network is selected and in this measure you can assign colors for each network:
Selected Network =
VAR __selectedNetwork = SELECTEDVALUE('Table'[Network])
RETURN
SWITCH(__selectedNetwork,
"Network A", "Red",
"Network B", "Blue",
"Network C", "Yellow"
)
and then in the settings of bar chart you can use this measure as a data colors:
The result:
| Proud to be a Super User. If I helped, please accept the solution and give kudos! |
- Anonymous5 years agoNot applicable
Hi lkalawski ,
This looks really good. But what I want is to have the bar chart for the [Product] field. So there will be 7 bars with 3 different colors (e.g. Pencil, Book, Pen in red color).
- lkalawski5 years agoResident Rockstar
Hi Anonymous
So, my solution will also work. You only have to change the Axis value in the chart: instead of Network please use Product. Conditional formatting should be as previous.
Proud to be a Super User.
If I helped, please accept the solution and give kudos!
Linkedin- Anonymous5 years agoNot applicable
Hi lkalawski ,
I tried to use this measure but it didn't work. The only things that worked is when you put else statement. I tried to check on my data value and changed it to text type but still didn't work.