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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Adumio
Frequent Visitor

Help for stacked column charts of two categories being repeated for multiple times

Hello everyone,

I have the sample data table below.

Group TypeY Value
Group 1Type A1
Group 1Type B2
Group 1Type A2
Group 1Type B2
Group 1Type B3
Group 2Type A1
Group 2Type A2
Group 2Type B2
Group 2Type A1
Group 2Type B1
Group 2Type B2
Group 2Type A2
Group 3Type B3
Group 3Type A3
Group 3Type A3
Group 3Type A1
Group 3Type B1
Group 3Type A1

What I want to achieve with Power BI is the following chart. The stacked columns are added by sequece.

Adumio_0-1711874746979.png

 

Adumio_1-1711783275008.png

It would be great if all charts can be combine in one single visual, so I can use slider to select what group to show. 

If not, one chart in one visual is still good.

Would you please suggest me how to do it in Power BI?

Note: The actual data has several hundred groups, two types, ~ 100 rows/group. Normally I will just need to select and make a comparison of 2 - 5 groups.

Thank you.

6 REPLIES 6
MNedix
Super User
Super User

Hi @Adumio ,

I'm not going to ask you why you want to do this - I am sure you have your reasons. I may have some ideas which could be put in practice in this case but I'm not 100% sure they will answer your question. I don't know how your data actually looks like and what the Types represent but your "problem" is that Power BI doesn't understand that you want to have different entries in the bar (on top of each other). So I was thinking of two ways of solving this:

 

Option 1. Re-index:

a. Re-index the entries and make them independent. Let's say you add an index column and then build a "Fake Type" based on the Type and Index (use CONCATENATE or CONCATENATEX for this). This will give you unique Type entries (see below).

b. "extract" the color base on the type (e.g. Type A -> Color A, Type B -> Color B)

c. Create a new table with the desired colors and link it to the main Table

d. Trick the chart formatting to use the color table for the Types (skipping the Fake Type stage). I know it's possible, I just don't know it off the top of my head.

 

Stacked column.jpgStacked column2.jpg

 

Option 2: Use Dates (not sure if this would work though, this may create other problems in itself)

a. if you have dates associated with your entries then use them for the Y axes to do the stacking cadence

 

If this solved your problem then please mark it as the solution so others can see it

 

Thanks,



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,
Adumio
Frequent Visitor

Hi @MNedix,

Thank you for your suggestion. Creating a "Fake Type" would be a good move. I see that to plot them in the correct order, we need to use numbers 01, 02, ..., 09 instead of 1, 2, ..., 9. 

I have changed the types "A" and "B" to types "Gray" and "Orange" which will be the colors of the bars too.

Group TypeY ValueIndexFake Type
Group 1Gray10101_Gray
Group 1Orange20202_Orange
Group 1Gray20303_Gray
Group 1Orange20404_Orange
Group 1Orange30505_Orange
Group 2Gray10606_Gray
Group 2Gray20707_Gray
Group 2Orange20808_Orange
Group 2Gray10909_Gray
Group 2Orange11010_Orange
Group 2Orange21111_Orange
Group 2Gray21212_Gray
Group 3Orange31313_Orange
Group 3Gray31414_Gray
Group 3Gray31515_Gray
Group 3Gray11616_Gray
Group 3Orange11717_Orange
Group 3Gray11818_Gray

I have searched around, it seems Power BI doesn't have the feature of differentiating the stacked bars' colors based on other column (column "Type" in my case). 

 

So I decided to change the color of each bar manually to achieve what I need.

Adumio_1-1711874243588.png

 

Hopefully, someone can advise me a solution (smarter and faster way to do it).

 

Thank you.

Adumio
Frequent Visitor

I have tried to work with my actual business data, just two groups, two color types, and ~ 200 rows of Y values (equivalent to ~ 200 "Fake Type"). Power BI only allowed to show the visual of the first 60 categories in the stacked bars (so I missed ~ 140 rows of data), and it's crazy to change the colors of 60 - 200 categories/ Fake Types (!). 

 

 

 

It seems that there is a thread opened for the ability to conditionally formatting the Legend of a chart (since the Fake_Type data in Legend - https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=31fd95a4-308f-4a28-a3d4-10489b973642).
However, perhaps PowerBI is not the right tool for this. From what I understand, you want to stack 200+ values on top of each other in one column or bar. The only case I know where this applies (and this is based on my professinal experience) is gene cluster analysis in spatial biology - see Seurat analysis (screenshot - each "line" represents the distribution of a certain gene (on the left) in a cluster of cells (on the top)).

 

I don't know if this solved your problem, it would be great if it did or if gave you another resolution path.

Seurat.jpg



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,
Dinesh_Suranga
Continued Contributor
Continued Contributor

Hi @Adumio ,
Are you happy with following ?

Or do you want to stack in same order in table?

Dinesh_Suranga_0-1711802221701.png

Thanks.

Hi @Dinesh_Suranga,

Thank you for spending your time on this. I would want to stack in same order in the table.

It should look like this.

Adumio_0-1711808065677.png

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors