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 have a table with two columns:
Category (Col A)
Price (Col B)
I want to create a stacked bar chart using these columns.
However, the key requirement is that the order of the category legends in the chart should be dynamic — based on a user-defined sorting order.
The user will assign a sorting number for each category, and the chart should update the legend order accordingly.
Can anyone please help me in this?
Solved! Go to Solution.
Hi @Jessica_17,
Currently power bi does not support direct user input into data model values from the report UI. The power bi report canvas is read only so the users cannot type or change data values like SortOrder dynamically for each row. So the user can't enter the value in UI itself for each category.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi @Jessica_17,
Thank you for reaching out to Microsoft Fabric Community.
Based on the requirement, please follow the below steps:
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
HI @v-achippa ,
Thanks for that. However, my main requirement is that the user should be able to manually enter or adjust the sorting order for each row directly within the Power BI UI—without relying on external sources like SharePoint, Excel, or manual dataset updates. Is there any way to make the sorting dynamic and editable by the user within the report itself?
Hi @Jessica_17,
Currently power bi does not support direct user input into fields like sort order from within the report UI. Users cannot manually change column values like sort order directly inside a visual or dataset in a published report.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi @Jessica_17,
Yes, we can choose a sort option from a slicer and use DAX to apply sorting dynamically in visuals
DynamicSort =
SWITCH(
SELECTEDVALUE('SortOptions'[SortOptionID]),
1, MAX('YourTable'[SortOrder]),
2, RANKX(ALL('YourTable'), 'YourTable'[Category],, ASC),
3, RANKX(ALL('YourTable'), CALCULATE(SUM('YourTable'[Price])),, DESC)
)
Use this logic to control sorting in the visuals.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi @Jessica_17,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
If my response addressed, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Thanks and regards,
Anjan Kumar Chippa
HI @v-achippa
Thanks for the solution, but unfortunately it did not worked, user wanted to enter value in UI itself for each category, and the chart should change accordingly.
Hi @Jessica_17,
Currently power bi does not support direct user input into data model values from the report UI. The power bi report canvas is read only so the users cannot type or change data values like SortOrder dynamically for each row. So the user can't enter the value in UI itself for each category.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi @Jessica_17 - Yes, you can definitely achieve dynamic legend ordering in a stacked bar chart in Power BI.
below are some of the solved reference links:
https://community.powerbi.com/t5/Desktop/Sort-legend-for-stacked-column-chart/td-p/2574412
Hope this helps.
Proud to be a Super User! | |
HI @rajendraongole1 ,
Thanks for that. However, my main requirement is that the user should be able to manually enter or adjust the sorting order for each row directly within the Power BI UI—without relying on external sources like SharePoint, Excel, or manual dataset updates. Is there any way to make the sorting dynamic and editable by the user within the report itself?
User | Count |
---|---|
85 | |
79 | |
64 | |
52 | |
46 |
User | Count |
---|---|
101 | |
49 | |
42 | |
39 | |
38 |