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 hierarchy above in my report and it goes down to level 9.
I also have a reporting order ID tagged at level 1 and when I try to sort this, it shows the following error.
From level 1 to level 9, it should be sorted in a specific order and I don't know how to do this..
Can someone please help?
Hi @tearless
Please add SortOrder column for each 9 columns in your database
or use Power Query conditional column to add a SortOrder Column.
Proud to be a Super User! | |
This is what I did.
I created hierarchy tables Level1... to Level 9 with ID that shows the order of each hierarchy member.
Then I joined these 9 tables with the data table which has those hierarchy member.
Then, I selected each hierarchy table and sorted by those IDs..
But the report still does not get sorted as needed.
Hi @tearless
To sort a hierarchy properly in Power BI, you need a separate sort column for each level of the hierarchy. In your case, since the hierarchy goes down to 9 levels, you should create individual sort columns for each level. These sort columns will define the specific order for each hierarchy level.
Let's assume your hierarchy has the following levels:
You need to create sort columns like:
Each sort column should have a unique value for each row to define the sorting order for that level.
Once you have these sort columns, you can set the sorting for each hierarchy level in Power BI by going to the column tools and selecting "Sort by Column" and choosing the appropriate sort column for each hierarchy level.
By doing this, you ensure that each level of the hierarchy is sorted in the desired order.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
This is what I did.
I created hierarchy tables Level1... to Level 9 with ID that shows the order of each hierarchy member.
Then I joined these 9 tables with the data table which has those hierarchy member.
Then, I selected each hierarchy table and sorted by those IDs..
But the report still does not get sorted as needed.
Hi @tearless
If you’ve correctly defined a sort order for each level in the hierarchy (numeric, which is required), sorted all the tables, and placed the dimensions from the relevant tables into the visualization, with the visualization itself sorted by what’s in the 'Rows', it should work. If it’s not working, something must have gone wrong along the way. To figure it out, I’d need to see the file. Please share a link to it (without sensitive data), and I’ll be happy to check it. Alternatively, I’m attaching a file I created for you with 4 hierarchies—this is enough to understand the logic, as it’s not dependent on the number of levels in the hierarchy.
Results :
+ you can download the pbix and follow my steps
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
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 | |
43 |