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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

Help Needed in Nested Sorting for Hierarchical Bar Chart

Hi Everyone, 

I'm a begginer in Power BI, We are working on a Tableau to Power BI Migration project where I'm facing some difficulties in converting one bar chart to power bi. 


Scenario : I have a category and subcategory and sales value plotted in a bar chart, I have turned of Concatenation, I want to show it by Category group (Highest Category First) then inside each group show sucategory bars (Highest Subcategory First).


I was able to achieve the first sort by creating a Total colum using ALLEXCEPT(). but I'm not able to do the second layer sorting. 

Any help is appreciated. 


Screenshot below:


Screenshot 2023-11-20 221413.png


Expected :  I want to show highest subcategory in DESC in each category. 


Sample File Download Link : Sample PBIX File 





Super User
Super User

is this whate you looking for


yes, This is what I'm looking for. Could you please share the steps which you followed. Thanks in Advance. 


Thank you. Its working for me. I do have one more query in the same DAX, on the same bar chart, I have visual level measure filter which restricts the data for sales >=1.  


The abpve dax is working without the filter, but if I add that visual level filters, the sort s not working properly. I know we have to add that filter somewhere inside the m2 calculation summarization part. 


Could you please help me with that as well ? Appreciate your help and time.

if you find that you have a lot of subcategories and because of this the measure is violated, then try this measure
You can replace 100 with 1000 if you have a lot of subcategories


I don’t understand, please share the file with the problem

Scenario : Need to show subcategories which having Sales more than 50. 

Problem : When I apply visual level filter, its resetting the sort.

PBI file : Sample PBI File - Filter Interfere with Sort  


Super User
Super User

@rintoalappat great minds are already here and provided the appropriate solutions, just curious, is this what you are looking for:




Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤

Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yes, subcategory is showing properly. but office supplies category should come at the beginning as per value desc.

Super User
Super User

Hi @rintoalappat 

Unfortunately, this functionality is unavailable.

Please refer to the linked discussion:

And vote for the linked idea:

To rank the values hierarchically you can use a matrix with conditional formatting.

It is also a much more efficient graph for ranking scenarios than  a clustered column:



pbix is attached

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


Thank you for the alternate solution. I do have some stacked legeds as well on the bar, I believe its not possible with Matrix bar visual

Hi @rintoalappat 
No, and don't recommend using stacked bars.
Please refer to my linked blog post which explains why.

"Home experiments" and stacked bar graphs (

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


Super User
Super User

@rintoalappat , When you sort ox Axis Category / subCategory, As of now you do not have option to sort subCategory based on value

Helpful resources

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

Top Solution Authors