Forum Discussion
Sorting multiple dimensions in Bar chart based on slicer selection
Hi All,
Please suggest how to sort dimensions in bar chart alphabetically at all times. Also I’m using slicer (field parameter) to toggle between dimensions in this case. Issue is Sort order dosent retain/saved when we toggle between dimensions.
7 Replies
- parry2k
Super User
Snagalapur are you using field parameter to toggle dimension?
- Snagalapur
Helper IV
Yes, I'm currently using field parameter to toggle dimension
- AnonymousNot applicable
Hi Snagalapur,
Thank you for reaching out in Microsoft Community Forum.
When using a field parameter to toggle dimensions in a bar chart, Power BI doesn't retain sort order because each dimension is treated as a separate field.
please follow below steps to Keep Alphabetical Sort When Using Field Parameters in Power BI
1. Create a dynamic axis column:
DynamicAxis =
SWITCH(
SELECTEDVALUE('Field Parameter'[Fields]),
"Country", 'YourTable'[Country],
"Region", 'YourTable'[Region],
"City", 'YourTable'[City]
)
2. Create a matching dynamic sort column:DynamicSortKey =
SWITCH(
SELECTEDVALUE('Field Parameter'[Fields]),
"Country", 'YourTable'[Country], -- or a custom alphabetical key if needed
"Region", 'YourTable'[Region],
"City", 'YourTable'[City]
)3.Use the dynamic axis on the X-axis of your chart and Set the dynamic axis to sort by the dynamic sort key using “Sort by column.”
Please continue using Microsoft Community Forum.
If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.
Regards,
Pavan.
- kushanNa
Super User
Hi,
I'm not quite sure what are you tying to achieve in here without looking at your dataset
but for field parameter sort order issue you can create a sort order column to fix it
this video explain how to do it https://www.youtube.com/watch?v=vo-8p7_3yZk&ab_channel=AccessAnalytic
- AnonymousNot applicable
Hi Snagalapur,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept as Solution" and give a 'Kudos' so other members can easily find it.
Thank you,
Pavan - AnonymousNot applicable
Hi Snagalapur,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, kindly "Accept as Solution" and give it a 'Kudos' so others can find it easily.
Thank you,
Pavan. - AnonymousNot applicable
Hi Snagalapur,
I wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.
If the community member's answer your query, please mark it as "Accept as Solution" and select "Yes" if it was helpful.
If you need any further assistance, feel free to reach out.
Please continue using Microsoft community forum.
Thank you,
Pavan.