This Power BI tutorial helps you work with a stacked bar chart sorted by value in Power BI.
Recently, I was working on a Power BI report where sorting a stacked bar chart by value helps me visualize which categories are the biggest contributors clearly and understandably.
In this tutorial, we will learn how to sort Power BI Stacked bar charts by value and how to sort Power BI stacked bar charts by legend.
Power BI Stacked Bar Chart Sorted by Value
This example shows how to sort Power BI Stacked bar charts by value.
Scenario:
You run a store selling different product categories, like fruits, vegetables, and snacks. Using a stacked bar chart sorted by value in Power BI, you can quickly see which products bring in the most money, helping you decide where to focus your efforts and make better business decisions.
According to this scenario, we have a SharePoint list named Store Sales Data that contains the following columns with various data types:
| Columns | Data Types |
|---|---|
| Product Name | Single line of text |
| Category | Single line of text |
| Sales($) | Currency |

Follow the below step to sort Power BI Stacked bar charts by value:
1. Open Power BI Desktop and load data using the Get data option. Then, we can see the data set in the Data Panel.

2. Under the Home tab, expand Visual gallery (black box) -> Click the Stacked bar charts.

3. Then, use the +Add data option to add Category into the Y-axis, Sales into the X-axis, and Product Name into the Legend field.

4. After that, you will see our Power BI stacked bar chart successfully created.

5. Select the stacked bar chart, then click on the three-dot (…) header icons at the top of the chart. A dialog box will open. In the dialog box, click on the Sort axis.

In the above box, “Category” refers to the alphabet, and “Sum of Sales ($)” represents the values. We have the option to sort by value (ascending/descending) or alphabetically (ascending/descending).
Now we see sort by value ascending in the stacked bar chart.
6. Select Stack bar chart -> click on the three-dot (…) -> Select Sort axis -> Select Sum of Sales ($) and Sort ascending.

This way, you can sort Power BI Stacked bar charts by value in ascending or descending order.
Power BI Sort Stacked Bar Chart by Legend
Now we see how to sort the Power BI stacked bar chart by legend in ascending or descending order.
Creating a stacked bar chart before we begin sorting in the Power BI stacked bar chart is important. Let’s consider the stacked bar chart we created above for this example.
1. Select the stacked bar chart, then click on the three-dot (…) header icons at the top of the chart. A dialog box will open. In the dialog box, click on the Sort legend.

2. Next, select “Product Name” and sort it in descending order.

Now, you should notice the changes. If not, you can hover over the stack in the Power BI Stacked bar chart.

Alternatively, you can sort it in ascending order to observe the differences.

This way, you can sort the Power BI stacked bar chart by legend in ascending or descending order.
Conclusion
I hope you follow the above steps to sort the stacked bar chart in Power BI.
This tutorial taught us how to sort Power BI stacked bar charts by value and sort stacked bar charts by legend with some real scenarios.
Additionally, you may like some more Power BI tutorials:
- Create a Power BI Pie Chart? + Formatting
- How to Create a Table in Power BI
- Create a Report from Excel in Power BI

Preeti Sahu is an expert in Power Apps and has over six years of experience working with SharePoint Online and the Power Platform. She is the co-author of Microsoft Power Platform: A Deep Dive book. As a Power Platform developer, she has worked on developing various tools using Power Apps and Power Automate. She also makes Microsoft 365 videos and shares them on YouTube.