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

Load Skrict get rank

Hello qlikers 🙂 ,

this is my table:

ID            TimeLength            Time
1              12:15:15                   12.12.2012
2              00:06:53                   15.12.2012
3              01:15:56                   16.12.2012
4              05:14:36                   18.12.2012

I want to write a Load script that me give a rank. 

For example, the solution should be: 

ID            TimeLength            Time                        Rank
1              12:15:15                    12.12.2012            1
2              05:14:36                    18.12.2012            2
3              01:15:56                    16.12.2012            3

As you can see, I want to create a rank table in my load script.

But I dont know how I could get the first rank, the second and the third.

Rank:
Load
    Time,
    Max(TimeLength)
Resident Table;

This script snippet whould give me only all time and the same max. But I want only the first rank, and so on.

Do you have any ideas? 🙂

Thank you in advance! 

Labels (2)
1 Solution

Accepted Solutions
Taoufiq_Zarra

If i understood correctly

 

Data:

load * inline [
ID,TimeLength,Time
1,12:15:15,12.12.2012
2,00:06:53,15.12.2012
3,01:15:56,16.12.2012
4,05:14:36,18.12.2012
];

Rank:
noconcatenate
load rowNo() as Rank,*
resident Data
order by TimeLength
DESC;

drop table Data;

 

output from Qlik

 

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

If i understood correctly

 

Data:

load * inline [
ID,TimeLength,Time
1,12:15:15,12.12.2012
2,00:06:53,15.12.2012
3,01:15:56,16.12.2012
4,05:14:36,18.12.2012
];

Rank:
noconcatenate
load rowNo() as Rank,*
resident Data
order by TimeLength
DESC;

drop table Data;

 

output from Qlik

 

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Anonymous
Not applicable
Author

Thank you for your support. 

But in my case I only need the first 3 values, the 4 is superfluous. So I have to restrict by 3 values.
How can I do this? 🙂

Taoufiq_Zarra

if i understood 🙂

you can in dimension in Pivot table for example use:

=if(Rank<4,Rank)

 

and delete Null Value

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉