Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I'm having an issue with the stacked bar chart. If I insert a value for the legend, then the chart will not sort properly when I select "sort by" from the graphic menu. It seems like the sort does not take into account the impact of the legend value. This seems like this might be a bug? Let me emphasize, I did select "sort by" multiple times but it never orders properly. I expect to Pareto both bar charts (in order of largest to smallest value).
No legend value:
With legend value:
Datasets:
Volume Data
Defect Data
Dataset Relationship:
Yield Contributor formula:
Yield Contributor = DIVIDE(SUM(Defect[Count]),SUM(Volume[Count]))
I actually found a solution!
I created a measure that did
CALCULATE(measure, Type = A) + CALCULATE(measure, Type = B) + CALCULATE(measure, Type = C)
Then I added this to the tooltip and sorted by this instead
Only 7 years later but I am having this same issue and cannot find another post to help me find a solution to this! Does anyone know why using a measure and a legend in stacked bar ruins the sort order?!
Hi @pbakaric,
Below is the result in my test, as you can see, the appearance of bar chart and the sequence of sort by are not affected by legend. Also, it is only allowed to sort the chart based on the columns added to Axis and Value, that is to say we cannot sort by legend.
From the two images you post, it seems that the value on X-axis is changed after adding legend. Are the source data the same in these two charts? What do you mean "the sort does not take into account the impact of the legend value"? It is not clear about how you want to sort the chart? Would you please provide more detaied description about your expect result, if possible you can upload your pbix file.
Thanks,
Yuliana Gu
Yuliana,
Thank you for the response. How do I upload a file? I don't see an option to add a file. I have created a simplified example to share. I have also updated my original post with that example.
To quickly address your questions:
1) Yes, the data source is the same in both charts.
2) I expect to show the graphic as a Pareto (order values from largest to smallest)
Hi @pbakaric,
Remove the relationship between these two tables.
If you still have any question, please feel free to ask.
Thanks,
Yuliana Gu
Yuliana,
The relationship is important and cannot be removed. Your calculated values are not correct with the relationship removed.
Why can the sort not take into account the impact of the legend? The sort order should be determined by the total value for each item.
Preston
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 |
---|---|
84 | |
76 | |
73 | |
42 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
42 |