Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunitha_chellaiah
Partner - Creator
Partner - Creator

Sort Data Based on Number of Leading Zeros

Hi All,

How to sort data based on leading zeros and not the actual number in qlik

Below is my example

Item Num
0064
000670402
0065FR
CS-CD-PSW-10-00
010240410

The data should be sorted based on number of zeros at the start in ascending order.

My final output should be like the below table

Item Num
000670402
0064
0065FR
010240410
CS-CD-PSW-10-00

Note : This is just an example . I have more that 30000 item numbers like this and i want to sort based on number of leading zeros

Labels (2)
5 Replies
igoralcantara

Have you try to disable the sort by numeric and have only the sort by alphabetically on?

Check out my latest posts at datavoyagers.net
anat
Master
Master

load len(PurgeChar(field,123456789)) as ZeroLength,field;
load * Inline [
field
001234
12008750
000765

];

use ZeroLength field for sorting

sunitha_chellaiah
Partner - Creator
Partner - Creator
Author

Yes I have tried . But its not working as expected

sunitha_chellaiah
Partner - Creator
Partner - Creator
Author

I have tried this. But not getting desired output

marcus_sommer

You may try it with the following as sort-index:

findoneof(lower(YourField), '123456789abc...xyz') as SortIndex