Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
Let say I have below table
| Network | Product |
| Network A | Pencil |
| Network A | Book |
| Network A | Pen |
| Network B | Knife |
| Network B | Pan |
| Network C | Bed |
| Network C | Pillow |
I want to make a bar chart for [Product] where the color is indicated by [Network]. I found the conditional formatting in Data Color only available for numerical rules (CMIW). Hope you can prove me wrong and find the alternative solution for this.
Thank you for your help.
Vano
Hi, @Anonymous
According to your description and Follow-up, I can clearly understand clearly what you want to get, you can create a measure like this:
Color =
SWITCH(
MAX('Table'[Network]),
"Network A","Red",
"Network B","Yellow",
"Network C","Grey")
Then you can create a column chart and place it like this, then set the conditional format for the data color using lkalawski’s solution, like this:
And you can get what you want.
You can download my test pbix file here
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
What do you want to achieve by using bar chart? Do you want to have number of product for each network and color each bar based on the network name? Can you draw your idea?
| Proud to be a Super User. If I helped, please accept the solution and give kudos! |
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! |
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).
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! |
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |