Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
LesJean
Contributor III
Contributor III

Sort by expression two differents numbers format

Hello everyone,

So I'm trying to sort two different "format" of numbers inside a single column. I'll give you a sample to make it clearer. Let's say I have the following numbers:

971036
44000969
44002021 971037
44002022 971047

Now, let's say I sort them in ascending order, I get the following sorting:

971036
971037
971047 44000969 44002021 44002022

Which of course makes sense, but I'm trying to order them in this way:

44000969
44002021
44002022
971036
971037
971047

Is there any way to do that in Qlik Sense? I'm guessing I'll have to use the "Sort by expression" option, but I can't seem to think up the syntax for what I'm trying to do. Is there any way to do this? Keep in mind that there are way more numbers than the example I gave, so I can't "hardcode" the order for the numbers with something like that:

MATCH(Article, '44000969', '44002021', '44002022', '971036', '971037', '971047')

Any help would be greatly appreciated,

Thank you,

LesJean

 

1 Solution

Accepted Solutions
sunny_talwar

If the length of two set of numbers stay the same, you can try this

1) Sort by Expression Descending -> Len(Num)

2) Sort by Numeric Value Ascending

image.png

View solution in original post

2 Replies
sunny_talwar

If the length of two set of numbers stay the same, you can try this

1) Sort by Expression Descending -> Len(Num)

2) Sort by Numeric Value Ascending

image.png

dwforest
Specialist II
Specialist II

what's the logic for your sort? its not descending.
If these are "intelligent" numbers, meaning the "4400" is a prefix indicating something, you could use string functions to parse out the pieces and sort.