Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AdamMG
Frequent Visitor

Stacked Bar Chart sliced by subcategory but coloring by category

Hi everyone.
I need to create a stacked bar chart where data can be sliced by subcategory, but coloring but category.
Normal stacked bar chart will look like this
aaaaaa bbb cc dddddddddd e fffffffffffffff
but
a,d,f will have a red color
b,c,e will have a green color 
etc

I have more than 20 categories and 20 subcategories

3 REPLIES 3
AdamMG
Frequent Visitor

I can see, this is not possible with PowerBI.
I did it using Python

amitchandak
Super User
Super User

@AdamMG , you can use measure-based conditional formatting for bar ( If no legend and only one measure) and use that in the conditional formatting using the field value option

 

 

example

Measure =
Switch(true(),
max(Table[Column]) = "R1" , "Red" ,
max(Table[Column]) = "R2" , "Green" ,
max(Table[Column]) = "R3" , "Pink "
)

 

How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
https://amitchandak.medium.com/power-bi-where-is-the-conditional-formatting-option-in-new-format-pan...

 

or

Power BI Customer to Retain, Scatter Quadrant -Segment in 4 quadrants based on Margin % and Discount, Use Constant Line- https://youtu.be/0k_C_E7YOQY

Your solution will not work with stacked bar chart - sorry

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors