Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Microsoft Power BI Community
- Forums
- Get Help with Power BI
- Desktop
- How to sort stacked column chart in Power BI deskt...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

Let

Frequent Visitor

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-10-2017
01:47 AM

Hello,

I would like to sort a stacked bar in Power BI.

However, the option button at the top-right corner doesn't seem to provide the sort feature.

Here are the sort criteria I want:

1. The longest bar first

2. The bar of which the green part is the longest first

*Repeat the 2. again and again for the other colors.*

Is that possible?

I tried this tutorial, but I had 2 problems

1. I couldn't implement the last step

2. The tutorial is not really what I want.. I want the sort options available right from the top-right button instead of in another table.

Here is the last step of the tutorial

With that in place, go to the Data view and add a New Column to the main table. Sort Order = RELATED(AuxTable[Sort Order])

-----------------------------------

My current stacked column settings are:

- Axis: number

- values: number

- Legend: text

Example of data:

[ { "x": 1, "y": 1000, "type": "car" }, { "x": 2, "y": 3000, "type": "car" }, { "x": 3, "y": 5000, "type": "car" }, { "x": 1, "y": 10000, "type": "plane" }, { "x": 2, "y": 13000, "type": "plane" }, { "x": 3, "y": 9000, "type": "plane" }, { "x": 1, "y": 2000, "type": "bike" }, { "x": 2, "y": 4500, "type": "bike" }, { "x": 3, "y": 8000, "type": "bike" } ]

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

v-ljerr-msft

Microsoft

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-12-2017
11:11 PM

Hi @Let,

The sort "The longest bar first" is available if the x-axis is type of Text.

How can I make it work even with numbers (for consistency) ? (Besides, if x-axis is the type of Text, the chart has an horizontal scrollbar)

To make the sort option work with numbers, you can just set **X-Axis** **Type** to "**Categorical**". However, with this option, all labels will be shown on the X-Axis, so an horizontal scrollbar will be shown up if the chart is not big enough.

Regards

7 REPLIES 7

Highlighted
##

Let

Frequent Visitor

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-10-2017
02:54 AM

Update:

The sort "The longest bar first" is available if the x-axis is type of Text.

How can I make it work even with numbers (for consistency) ? (Besides, if x-axis is type of Text, the chart has an horizontal scrollbar)

Highlighted

v-ljerr-msft

Microsoft

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-12-2017
11:11 PM

Hi @Let,

The sort "The longest bar first" is available if the x-axis is type of Text.

How can I make it work even with numbers (for consistency) ? (Besides, if x-axis is the type of Text, the chart has an horizontal scrollbar)

To make the sort option work with numbers, you can just set **X-Axis** **Type** to "**Categorical**". However, with this option, all labels will be shown on the X-Axis, so an horizontal scrollbar will be shown up if the chart is not big enough.

Regards

Highlighted
##

comish4lif

Helper II

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
01:37 PM

Where can I find the option to sort by "Longest Bar First"?

Highlighted
##

comish4lif

Helper II

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
03:02 PM

Oh, there it is. I'm posting a picture here to help the next lost Dashboarder. It'll be in the top right of your visualization.

Highlighted
##

cjdw_PU

Regular Visitor

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-10-2018
07:28 AM

Hi comish, I don't think this preserved the sort order of the x-axis. Choosing that "Sort by Count of Change Type" makes the x-axis resorted by the x-axis values with highest bar (regardless of individual color size within a bar) to the lowest.

Hi Let,

In my stack bar,

Axis: text. Shown in ascending order. I am okay with this

Legend: text.

Value: Count of the column in legend.

I am still trying to figure out: while preserving the sort order of the x-axis (Data type: text, sorted ascending), how to sort longest bar first within each x-axis bar? Longest bar to shortest bar is determined by Value.

Any help is appreciated.

Highlighted
##

LeviCaers

Frequent Visitor

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-12-2018
02:50 AM

Hi,

I'm experiencing the same problem I've searched for the option longest bar first but I cannot find it.

My X-axis is of type text and the values are a count of type whole number.

Any suggestions.

Cheers

Highlighted
##

bartbouwman

Frequent Visitor

Re: How to sort stacked column chart in Power BI desktop?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-09-2020
02:28 AM

Hey,

You already find a solution for this problem? I am facing the samen problem at the moment..

Top Solution Authors

User | Count |
---|---|

433 | |

321 | |

81 | |

63 | |

49 |

Top Kudoed Authors

User | Count |
---|---|

564 | |

517 | |

161 | |

143 | |

134 |