Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

ranking the first x lines of a straigt table

Hello

Got a straight table with 1 dimension and 2 expressions (exp1 and exp2)

and the data is sorted by values of exp1 desc

now suppose I got the following data in the pivot table

Dim        Exp1    Exp2

A        116       25%

B        66        100%

C        21        35%

D        20        12%

E        20        10%

F       14          75%

....

now for the first 5 rows I want to add a rank from 1 to 5 and it has to be as follows:

Dim        Exp1    Exp2     Rank

A        116       25%         3

B        66        100%        1

C        21        35%          2

D        20        12%          4

E        20        10%          5

F       14          75%         -

....

how can this be done?

is it possible?

I can walk on water when it freezes
1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe this (replace with your expression)

rank(only({$<Dim={"=rank(Exp1,4)<=5"}>} Exp2),4)

View solution in original post

1 Reply
maxgro
MVP
MVP

maybe this (replace with your expression)

rank(only({$<Dim={"=rank(Exp1,4)<=5"}>} Exp2),4)