Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to get the rank of a dataset?

Dear all,

i have a table in which i want to know the rank of each dataset..

how to achieve that.

Regards,

aashish

1 Solution

Accepted Solutions
sushil353
Master II
Master II

ok..

try this:

t1:

load * inline

[

customer,purchase

a,10

a,20

b,30

c,40

];

t2:

load *,

autonumber(purchase) as rank

resident t1

order by purchase desc;

drop table t1;

HTH

Sushil

View solution in original post

5 Replies
sushil353
Master II
Master II

if you are calculating in chart then you can use rank() function...

if it is in script then use autonumber to generate the ranks for each dataset..

HTH

Sushil

Anonymous
Not applicable
Author

i want to implement it in script level...

data is like:

customer, purchase

a,10

a,20

b,30

c,40

Thanks!

Not applicable
Author

Hi Aashish,

Can you please elaborate the problem... however you can try "rank" function...

Best Regards

sushil353
Master II
Master II

ok..

try this:

t1:

load * inline

[

customer,purchase

a,10

a,20

b,30

c,40

];

t2:

load *,

autonumber(purchase) as rank

resident t1

order by purchase desc;

drop table t1;

HTH

Sushil

Anonymous
Not applicable
Author

Thank you!!