Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
raju8004212
Frequent Visitor

sorting issue

if i place max(sales) in x-axis and customer name into yaxis and orderyear into legend in bar chart of power bi im not able to sort the visual its giving random sort

i have tried making with orders table of sample superstore suggestions please

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @raju8004212  -yes, this is a known limitation with Power BI. Power BI cannot sort by a measure across all legend categories. If you want to still use the legend (e.g. Order Year), then create a ranking measure per customer based on total or max sales, and use that to sort your Y-axis (Customer Name).

 

create as like 

Customer Rank =
RANKX(
ALL('Orders'[Customer Name]),
CALCULATE(MAX('Orders'[Sales]))
)

Then go to your Customer Name column, and in the Modeling tab, set "Sort by Column" = [Customer Rank].

Now your Y-axis (Customer Name) will sort according to max sales despite the legend.

 

solved reference links:

Stacked bar chart won't sort properly with value i... - Microsoft Fabric Community

Sort Legend in Power BI

 

Hope this helps.

 





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

Proud to be a Super User!





View solution in original post

4 REPLIES 4
v-echaithra
Community Support
Community Support

Hi @raju8004212 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @raju8004212 ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @raju8004212 ,

We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

rajendraongole1
Super User
Super User

Hi @raju8004212  -yes, this is a known limitation with Power BI. Power BI cannot sort by a measure across all legend categories. If you want to still use the legend (e.g. Order Year), then create a ranking measure per customer based on total or max sales, and use that to sort your Y-axis (Customer Name).

 

create as like 

Customer Rank =
RANKX(
ALL('Orders'[Customer Name]),
CALCULATE(MAX('Orders'[Sales]))
)

Then go to your Customer Name column, and in the Modeling tab, set "Sort by Column" = [Customer Rank].

Now your Y-axis (Customer Name) will sort according to max sales despite the legend.

 

solved reference links:

Stacked bar chart won't sort properly with value i... - Microsoft Fabric Community

Sort Legend in Power BI

 

Hope this helps.

 





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

Proud to be a Super User!





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.