Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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 (1)
1 Solution

Accepted Solutions
marcus_sommer

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
Community Manager
Community Manager

@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. 

Sue Macaluso
erric3210
Creator
Creator
Author

Hi Ma'am,

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

Regards,

Eric

marcus_sommer

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

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