Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I am looking to arrange the legend values of a stacked bar chart in a sequence that is not alphabetical or sorted numerically. I would like to define this order manually. Adding an image of the chart for reference -
The legend values are all in one column, hence sorting within visul settings is not an option.
Thank you in advance.
Solved! Go to Solution.
Hi @abhiram88
In Power BI, when you want to manually control the order of legend items in a stacked bar chart—especially when the legend values come from a single column and are not sorted alphabetically or numerically—you need to define a custom sort order using a supporting column. Since the visual’s formatting options don’t allow manual ordering of legends when they originate from a single column, the best practice is to create a calculated column (in Power BI or Power Query) that assigns a numeric order to each stage (e.g., Planning = 1, Initiating = 2, Executing = 3, etc.). Then, in your data model, you use the “Sort by Column” feature to sort the legend column by this new numeric column. This custom order then dictates how the legend appears both in the visual and in the stacked sequence. For example, if your legend field is called ProjectStage, you can create a new column ProjectStageOrder, and then in Power BI select the ProjectStage column, go to the Modeling tab, and click "Sort by Column" → ProjectStageOrder. This will enforce your custom sequence visually and ensure consistency across charts.
Hi @abhiram88
In Power BI, when you want to manually control the order of legend items in a stacked bar chart—especially when the legend values come from a single column and are not sorted alphabetically or numerically—you need to define a custom sort order using a supporting column. Since the visual’s formatting options don’t allow manual ordering of legends when they originate from a single column, the best practice is to create a calculated column (in Power BI or Power Query) that assigns a numeric order to each stage (e.g., Planning = 1, Initiating = 2, Executing = 3, etc.). Then, in your data model, you use the “Sort by Column” feature to sort the legend column by this new numeric column. This custom order then dictates how the legend appears both in the visual and in the stacked sequence. For example, if your legend field is called ProjectStage, you can create a new column ProjectStageOrder, and then in Power BI select the ProjectStage column, go to the Modeling tab, and click "Sort by Column" → ProjectStageOrder. This will enforce your custom sequence visually and ensure consistency across charts.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
20 | |
18 | |
16 | |
15 |
User | Count |
---|---|
32 | |
19 | |
19 | |
16 | |
16 |