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
rolf1994
Helper II
Helper II

Sort legend in different way

Hi,

 

When creating a stacked column chart with a legend I get the following result:

Power BI legend sorting.png

 

As you can see, the legend sorts from top to bottom (1 to 5) and the stacked column sorts from top to bottom (5 to 1).

 

I think analyzing the stacked column if the legend was sorted from 5 to 1 would be much easier, is there a way to do this? I want the legend positioned on the left.

1 ACCEPTED SOLUTION
theBIbutler
Resolver II
Resolver II

Hi,

 

I had a quick play and couldn't find any way of changing the sort order of the legend independently of the stacked bar.  

 

Achievable with layered visualisations though:

 

Opposite Sort Order.png

Can send you the .pbix if you need it?

 

Cheers

 

Mark

View solution in original post

10 REPLIES 10
theBIbutler
Resolver II
Resolver II

Hi,

 

I had a quick play and couldn't find any way of changing the sort order of the legend independently of the stacked bar.  

 

Achievable with layered visualisations though:

 

Opposite Sort Order.png

Can send you the .pbix if you need it?

 

Cheers

 

Mark

Hi theBIbutler

 

Im really struggling with this particular issue.  Pulling my hair out trying to get this right 🙂

 

I know you did this a while ago but is it possible for you to share that .pbix with me?

 

 

Hi,

 

You're lucky.... I still have it!

 

PM me your email address and I'll send it on....

 

Cheers

 

Mark

Hi the BIbutler,

I am facing the same issue. I hope I am lucky too to get the .pbix file.

Great thanks.
Amy

Sure, PM me your email address.

 

Is there anyway of attaching it in here does anyone know?

In case anyone is looking for a workaround...

 

Create a stacked bar chart, and put the legend where you want it.  It's backwards.  Ugh.  Great.

 

Now copy/paste the visualization and convert it into a pie chart.  Click the "..." and choose to sort Z-A of your legend.

 

Now get rid of the legend in your bar chart and turn the background on, and set the transparency to 0%.

 

Now for the magic: PUT THE PIE CHART BEHIND THE BAR CHART, and leave the pie chart's legend sticking out.  Ta-da!  You now have a stacked order that matches your legend order.

 

"But Shefik," you immediately say.  "That's all well and good, but now the stack AND the legend are both backwards."  That's where I tell you to pray to the Power BI gods and hope that they make the legend order configurable in a future monthly release.  This is the best I can do for you.

Hi the BIbutler,

I am facing the same issue. I hope I am lucky too to get the .pbix file.

Great thanks.
Amy

Thanks for your reply!

 

That looks the way that i want it. I would like you to share your .pbix if possible but one thing:

 

If you did it by creating a measure for 1, 2, 3... then unfortunately it is not going to work in my case because the legend is going to have over 1000 different measures, depending on the filters selected.

Yeah needed a couple of additional columns.  Are your 'measures' in your legend numbers?  There must be some formula/easy way to reverse the order which is all you need for this?

 

 

If the legend is made up of numbers then I've managed to do that.....pm me your email address and I'll forward on the .pbix.....

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.