cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
swong Regular Visitor
Regular Visitor

stacked graph order

Hi,

 

I have a stacked bar chart, and the different segments are:

 

Exact, Full, Partial, Traditional

 

My bars are stacked in that order (alphabetical), with "Exact" on the bottom and "Traditional" on top. However, I want my segments to be ordered the opposite, with "Traditional" on bottom and "Exact" on top.

 

I created a Sort table, with each of my segments and it's corresponding order, e.g. (Traditional, 1), (Partial, 2). I then added a column to my original table:

 

Sort Order = RELATED(SortTable[Sort Order])

 

and sorted the original table by this column. However, this didn't change the order of segments in my stacked bar chart. How can I make the chart reflect my custom ordering?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yulgu-msft Super Contributor
Super Contributor

Re: stacked graph order

Hi @swong,

 

Currently, it is not supported to sort the chart based on legend. Someone has submitted this feature request, you can clisk to vote it up. Custom order for legend in stacked bar chart

 

As a workaround, you could create Measures for each segment. Then place each Measure in the Values area in the order you need. However, this workaround might not apply to the scenario where you have many legend items.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Super User
Super User

Re: stacked graph order

Have you tried sorting from the ellipsis in the top right corner of the chart. Not sure if that affects the stack order or not



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
swong Regular Visitor
Regular Visitor

Re: stacked graph order

Hm I'm not getting the option to sort -- my only options are:

 

EllipsesPic.PNG

Super User
Super User

Re: stacked graph order

Sorry, I'm not at my PC so didn't check. I thought all charts had a sort feature there 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
v-yulgu-msft Super Contributor
Super Contributor

Re: stacked graph order

Hi @swong,

 

Currently, it is not supported to sort the chart based on legend. Someone has submitted this feature request, you can clisk to vote it up. Custom order for legend in stacked bar chart

 

As a workaround, you could create Measures for each segment. Then place each Measure in the Values area in the order you need. However, this workaround might not apply to the scenario where you have many legend items.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

wynhopkins Member
Member

Re: stacked graph order

I think I have a solution to this.

 

If you set up a separate Table (use Enter Data) containing Exact, Full, Partial, Traditional  and then type 1,2,3,4 in the column next to it you can then connect that to your table that is currently being used in your chart.

 

Use this new column of of segment names in your chart instead of the original ones.

 

You can then use the Sort By Column option under Modelling to get your segments to show any order you want.

Highlighted
Anonymous
Not applicable

Re: stacked graph order - solved my upside down traffic light!

thanks, using measures,  has solved my upside down traffic lightorder of traffic light.PNG

Chels Frequent Visitor
Frequent Visitor

Re: stacked graph order

You can also solve this simply by creating separate measures for each variable you would like to show on the stacked chart. You can then order them as you wish in the column values field under Visualisations.

wbmarshall Visitor
Visitor

Re: stacked graph order

The proposed workaround of using measures for sorting is not acceptable for my organization's purposes.  By using measures in place of a single Legend column, we lose the ability to filter or drill from the individual bar segments.

 

UPDATE: I found a solution that worked for me.  In involves setting the "Sort By Column" property on the column itself, either in the embedded Power BI model or in SSAS.  For more info, see here: https://stackoverflow.com/questions/51156029/how-to-sort-a-bar-chart-in-microsoft-power-bi-desktop

 

 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 167 members 1,872 guests
Please welcome our newest community members: