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
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors