Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Problems with data structured in table Power BI

I have a problem with the data that is sorted in the table, in such a way that there is one structure of the order of the data in my data while it is reported to me (visualization of the table moves that structure). It's about the fact that I have to link certain data to a certain city in such a way that these data are located above or below the name of the city, in total I have three cities and about 23 data that need to be restructured. In the preparation, they are arranged properly, but when I publish them in a report in the form of a table, they disrupt the order in such a way that the cities are located one below the other and the other data above them. Please help how to solve it thanks a lot.

Regular Visitor


 I get this when I load data related to the problem I have, and this order should also be displayed in the visualization. namely, there are names with a number next to the name and only cities, and instead of giving me how it is in the editor, I get a completely different layout (photo below), I hope you understand what the problem is, please help


 the last photo is a problem because the data is complex as it shouldn't be, but it should go with the name of the city and then a specific number of entities below, then again the name of the city and a specific number of entities related to that city and so on


Memorable Member
Memorable Member

Hi @Nikolakoka,


you need to add an index/rank column in PQ (when the data loads).

And then sort the cities (et.) using this column:








john hello, thank you very much for trying to help me, unfortunately in my power bi editor I change the option to add rank and so I try to solve the problem.
I sent you two photos of my editor and what I found in the explanation on the microsoft documentation. please can you help me in any other way.
I greet you warmly

Hi mate,


instead of using Rank Column, choose to add an Index Column. It will freeze the order you see at the moment this step is performed (if you are happy with that).


When the data is loaded, sort it to the index column as described in the previous post.


If you want something more generalised/complicated (i.e. the data is not sorted in the way that you like it to be), you can use a ranking table which contains possible values and how are they ranked to your liking. In this case, you would merge this ranking table to the main one, extended the merged ranking column to the main table and then replaced any null with something like 999999 to make any value, which is not in the ranking table to come last in your data.




John thanks a lot, I'll try the proposed model and let you know if I've been able to solve the problem, this seems very complex. I hope your solution will help, I'll let you know the feedback.

Best regards 


Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors