Forum Discussion
Sort x axis by legend
Hi all,
I have a graph with Ids and the hours they were worked on. Then in the legend I have the region they were worked on.
I would like to sort the graph to see all ID in region 1 then all ids is region 2 and so on. I would prefer to display this information in a car graph.
Does anyone if thus can be done?
- Anonymous6 years ago
Basically you need sort by region first then sort ID. To sort by 2 columns, please refer to the solutions from the follwoing post:
Using Dax:
https://community.powerbi.com/t5/Desktop/Sorting-by-2-columns/td-p/424449
And using Power Query:
https://community.powerbi.com/t5/Desktop/Sorting-a-table-using-multiple-columns/td-p/447941
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
Cwb123 , Create a sun category rank (on id) and append it with your region. And then mark it as the sort column for ID
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415Sort column
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
- AnonymousNot applicable
Basically you need sort by region first then sort ID. To sort by 2 columns, please refer to the solutions from the follwoing post:
Using Dax:
https://community.powerbi.com/t5/Desktop/Sorting-by-2-columns/td-p/424449
And using Power Query:
https://community.powerbi.com/t5/Desktop/Sorting-a-table-using-multiple-columns/td-p/447941
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.