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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
krzohi
Contributor III
Contributor III

Get sorted values

Hi all,

i need to get TOP 3 of sorted values to make separate tables and also use those values for next filtering

krzohi_0-1624451678860.png

I tied to use FirstSortedValue() but it sorting only by unique values, so on output i got rows 1,2,4 from my example.

Thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
krzohi
Contributor III
Contributor III
Author

Ok, i solve it.. value + timestamp should be in brackets: 

FirstSortedValue( timestamp, - (value + timestamp))

View solution in original post

4 Replies
sunny_talwar

Would you be able to share the expression you have used?

krzohi
Contributor III
Contributor III
Author

I think i solve my problem by adding 'timestamp' to 'value' to have uniqe value for sorting:

FirstSortedValue( timestamp, - value + timestamp)

 

krzohi
Contributor III
Contributor III
Author

Hi, 

i have another problem right now which i missed before. I want rows as in previous example, table had two sorts, first by 'value' and second by 'timestamp' descending, so that i was able to get on output the newest highiest values.

The issue is that in function FirstSortedValue() i cannot set second sorting (by default 'timestamp' is sorted ascending). 

Oddly as i use FirstSortedValue( timestamp, - value + timestamp), the 'timestamp' in 3rd row is bigger so sorting by value + timestamp  should be as i expect, but no..

krzohi_1-1624516059781.png

krzohi
Contributor III
Contributor III
Author

Ok, i solve it.. value + timestamp should be in brackets: 

FirstSortedValue( timestamp, - (value + timestamp))