cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nitin_bhatnagar
Resolver I
Resolver I

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
T-Shirt Design Challenge 2023

Power BI T-Shirt Design Challenge 2023

Submit your creative T-shirt design ideas starting March 7 through March 21, 2023.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors