Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
erric3210
Creator
Creator

Complex Sorting Required

Hi All,

I'm trying to achieve complex Sorting but not able to do so in Sort Expression.

What I want is High to Low Sorting but it has some conditions:

Sort in descending order but if there are same values before decimal like 4.112, 4.111 & 4.113 than Sort it in Ascending order like this 4.111, 4.112 & 4.113

This is what I want:

Complex Sorting.png

 

Regards,

Eric

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

You could try something like this as sort-expression:

rangesum(floor(Score), 1-frac(Score))

- Marcus

View solution in original post

7 Replies
Sue_Macaluso
Former Employee
Former Employee

@erric3210 Are you using QlikView or Qlik Sense? I would like to move this into the correct product forum. This is generally used for non-product related discussions. 

Did you find a solution to your question? Mark the solution as accepted : and if you found it useful, press the like button!
erric3210
Creator
Creator
Author

Hi Ma'am,

I'm using Qlikview. Thank you so much. Appreciate that help.

Regards,

Eric

marcus_sommer
MVP
MVP

You could try something like this as sort-expression:

rangesum(floor(Score), 1-frac(Score))

- Marcus

erric3210
Creator
Creator
Author

Hi Marcus Sir,

This is exactly what I want. Your solution worked in my case.

Regards,

Eric

erric3210
Creator
Creator
Author

Hi Markus Sir,

@marcus_sommer 

How to handle below case:

Logic_Fail.png

 

 

Regards,

Eric

marcus_sommer
MVP
MVP

What's the problem? From a sorting point of view it should equally work if there are 3 or 4 or even more digits. If the different lengths are troubling you may cut them with round(Score, 0.001) or you used a formatting to show only the wanted number of digits - whereby you could show less as exists or more, like:

num(Score, '#.00') respectively num(Score, '#.00000')

The exact format-pattern for num() depends on the used number-formatting in your application.

- Marcus

erric3210
Creator
Creator
Author

Thanks again Marcus. That was logical. I got it.

Regards,

Eric