Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Incorrect sorting of iterations in a visual

I have a column for iteration paths like: iter\2.0, iter\2.0\2.0.1, iter\2.0\2.02,..., iter\2.0\2.10, iter\2.0\2.11.

Now my problem is that these paths are not shown correctly in the visual, no matter what kind of sorting I use.

 

The display comes like: iter\2.0, iter\2.0\2.01, iter\2.0\2.0.10, iter\2.0\2.0.11,...,iter\2.0\2.0.2, iter\2.0\2.0.3.

 

The display does not seems correct, instead it should come like this one only: iter\2.0, iter\2.0\2.0.1, iter\2.0\2.02,..., iter\2.0\2.10, iter\2.0\2.11.

 

Any ideas on how to sort these iterations properly in the visual?

 

Thanks

1 ACCEPTED SOLUTION
Ale
Resolver II
Resolver II

As this is a text field, Power BI is sorting them alphabetically. That's why the iter\2.0\2.0.10 comes before iter\2.0\2.0.2.

 

It understands that 10 comes before 2 because it takes character by character to sort, so 1 comes before 2. Just like in a text.

 

What you can try to do is to create a column with only the number part and make sure the data type is Number. Then in the Data View, you select your iterator column to be sorted by this new column. Finally, in the visual, when you select "sort by" it will sort by the new column which is sorted numerically and not as a text.

View solution in original post

1 REPLY 1
Ale
Resolver II
Resolver II

As this is a text field, Power BI is sorting them alphabetically. That's why the iter\2.0\2.0.10 comes before iter\2.0\2.0.2.

 

It understands that 10 comes before 2 because it takes character by character to sort, so 1 comes before 2. Just like in a text.

 

What you can try to do is to create a column with only the number part and make sure the data type is Number. Then in the Data View, you select your iterator column to be sorted by this new column. Finally, in the visual, when you select "sort by" it will sort by the new column which is sorted numerically and not as a text.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.