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
Veternus
Frequent Visitor

Sort Legend pf Column Chart with measures as Values

Hello good people! 

 

I have run into an issue with my graph in Power BI. I currently have a Stacked Column Chart, where there is Date on X-Axis and Measures that return values on Y-Axis. The legend is sorted like this: 

Veternus_0-1713776293233.png

That means the measure that is on the bottom of the graph is shown as first in legend etc. I would like to invert the legend, so it's in the same order both in the graph and in the legend. How do I do it? 

 

Thank you and have a great day! 

 

1 ACCEPTED SOLUTION

Hi @Veternus 
Your graph and text are currently sorted in the same way. However, since graphs start from the bottom and go up, the beginning and base are at the bottom (laws of construction and physics 🙂 ). On the other hand, a legend is a list, and lists of text go up to the top. Therefore, it looks reversed. So you actually want to sort the graph and the legend in reverse order. Since there is no way to do this from the graph, you can create a table with conditional formatting that matches the legend and group it with the graph.

Ritaf1983_0-1713800082334.png

The steps you can apply to achieve the result :

1. Create a disconnected table with the column of measure name and the column of sort order :

Ritaf1983_1-1713800228584.png

2. Sort the names of measures by the order column :

Ritaf1983_2-1713800308131.png

3. Create a measure for a circle ( like graph's marker)

circle = UNICHAR(11044)
4. Create a table visual with the measure name and the circle measure:
Ritaf1983_3-1713800515867.png

5. Change the column name of the circle to space + apply conditional formating :

Ritaf1983_4-1713800677314.png

6. Switch off the legend of the graph and group the table with the graph:

Ritaf1983_5-1713800745676.png

Pbix is attached 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

5 REPLIES 5
Veternus
Frequent Visitor

My Visualizations pane looks like this: 

Veternus_0-1713786693496.png

Each of the "Test1, Test2..." values is a different measure. 

I want to achieve this: 

Veternus_1-1713786908825.png

 

Hi @Veternus 
Your graph and text are currently sorted in the same way. However, since graphs start from the bottom and go up, the beginning and base are at the bottom (laws of construction and physics 🙂 ). On the other hand, a legend is a list, and lists of text go up to the top. Therefore, it looks reversed. So you actually want to sort the graph and the legend in reverse order. Since there is no way to do this from the graph, you can create a table with conditional formatting that matches the legend and group it with the graph.

Ritaf1983_0-1713800082334.png

The steps you can apply to achieve the result :

1. Create a disconnected table with the column of measure name and the column of sort order :

Ritaf1983_1-1713800228584.png

2. Sort the names of measures by the order column :

Ritaf1983_2-1713800308131.png

3. Create a measure for a circle ( like graph's marker)

circle = UNICHAR(11044)
4. Create a table visual with the measure name and the circle measure:
Ritaf1983_3-1713800515867.png

5. Change the column name of the circle to space + apply conditional formating :

Ritaf1983_4-1713800677314.png

6. Switch off the legend of the graph and group the table with the graph:

Ritaf1983_5-1713800745676.png

Pbix is attached 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Oh yeah, I understand why it's sorted this way, but our management doesn't like it -.- 

Thank you for this solution, it answers my question and does the precise thing I need it to do 👍

Happy to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
johnbasha33
Super User
Super User

@Veternus 

To invert the legend order in your Stacked Column Chart in Power BI, you can follow these steps:

1. Select the visual (the Stacked Column Chart) where you want to invert the legend order.
2. In the Visualizations pane on the right, find the field that you're using for the legend (in your case, it seems to be the "Measure" field).
3. Click on the ellipsis (...) next to the "Measure" field in the Visualizations pane to open the context menu.
4. From the context menu, select "Sort By" and then choose the measure you want to sort by. This will change the sorting order of the legend.
5. If the measure you want to sort by is not listed in the "Sort By" options, you may need to create a new measure specifically for sorting purposes. You can create a measure that assigns a numeric value to each category based on the desired sorting order.
6. After sorting the legend by the desired measure, the legend order should be inverted to match the order in the graph.

By following these steps, you should be able to invert the legend order in your Stacked Column Chart to match the order in the graph.

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

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