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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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