all the sorting options in the post side by side
Power BI Tips, Uncategorized

Sorting Bar Charts Power BI Workaround

It comes up at every PowerBI conference I attend.

a particularly magnificent horse
Horses are magnificent. Let’s not beat them to death.

I was in a business luncheon at the Power BI World Tour Event in Seattle this week where THE Will Thompson said it was a ‘known issue’. But in playing around with it, I found a possible workaround that might save you from having to explain to your report consumers thinking ‘that should be fairly simple to do… right?’, that in fact, no.

Let’s get to it. Here’s how to sort columns on a bar chart.

Say you start with some data. I made sure neither column was in any particular order.

Table of 5 kinds of pies and a random value between 0 and 100 for each as their popularity

Here’s what happens when I make a bar chart out of it:

Bar chart sorted by popularity, descending

I’m assuming PowerBI has some kind of default logic to sort these. From what it did here, it might be by amount.

SOLUTION: Sort the data in your table immediately before creating your visual. To do this, go to the data view on the left side of the application. Then click Modeling > Sort by Column > choose which column you’d like to have your bars sort on.

screenshots of the steps described

RESULT:

I sorted by data by “Pie” (A-Z), then made a visual and I got:

bar chart sorted by pie name alphabetically

Boom!

The takeaway here is that you have to get your data sorted BEFORE you create the visual. If you change the sorting on your data later, it doesn’t affect the ordering of your bars.

And just because we can, let’s do all the possible combinations. Such Zen.

A comparison of the bar chart with default sorting, sorting by pie name, and sorting by popularity.

What else are you stuck on? Let me know and I might use it as an idea for a future post!

Con Mucho Am(ad)or,

Liz

Leave a comment