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

What is Rank() ?

Hey,

Can anyone explain me Rank() with example ?

ALso what does Rank('fieldname' , 4,1) means??

Thanks

9 Replies
Gysbert_Wassenaar

Can you explain which part of the explanation of the Rank function in the help file you don't understand?

You can find an example of the rank function here: Top 5 analysis using Rank fuction


talk is cheap, supply exceeds demand
hic
Former Employee
Former Employee

The Rank function ranks the numbers. It only makes sense in a chart or inside an Aggr().

Image3.png

HIC

Not applicable

Dear nikil,

Ranking means arranging data in a order and marking them as it's level.

Ex:-           Name                    Score          Rank

                 A.                         101               02

                  B.                         110               01

                 C.                           98               04

                  D.                         99                 03

Priyantha.

buzzy996
Master II
Master II

Rank() function helps to display the N number (example 5,10,20..etc) of TOP/BOTTOM values in either Ascending/Dec ending Order in QlikView reports.

Not applicable

Hi..

Shiva Reddy

I want your help give me Email Id:

Srinu

buzzy996
Master II
Master II

rank( [total] expression [, mode [, format]] )

Evaluates expression, compares the result with the result on the

other rows within the current column segment and returns the ranking

of the current row within the segment. For image charts the current

column segment is defined as it appears in the chart's straight

table equivalent.

If the chart is one-dimensional or if the expression is preceded by

the qualifier total, the current column segment is always equal to the

entire column. If the table or table equivalent has multiple vertical

dimensions, the current column segment will include only rows with

the same values as the current row in all dimension columns except

for the column showing the last dimension in the inter field sort

order.

The ranking is returned as a dual value, which in the case where

each row has a unique ranking will be an integer between 1 and the

number of rows in the current column segment.

In a case where several rows share the same ranking, the text and

number representations can be controlled as follows:

The second parameter mode specifies the number representation of

the function result

mode

0 (default)

CHART EXPRESSIONS

415

I

If all ranks within the sharing group fall on the low side of

the middle value of the entire ranking, all rows get the lowest

rank within the sharing group.

If all ranks within the sharing group fall on the high side of the middle

value of the entire ranking, all rows in the group get the highest

rank within the sharing group.

If ranks within the sharing group span over the middle value of the

entire ranking, all rows in the group get a value corresponding to the

average of the top and bottom ranking in the entire column segment.

1 lowest rank on all rows in the group

2 average rank on all rows in the group

3 highest rank on all rows in the group

4 lowest rank on first row, then increment by one for each

row in the group

The third parameter format specifies the text representation of the

function result

format

0 (default)

low value&'-'&high value on all rows in the group (e.g. '3-

4')

1

low value on all rows in the group

2

low value on first row, blank on the following rows in the

group

The order of rows for mode 4 and format 2 is the determined by the

sort order of the chart dimensions.

Note Suppression of zero values is automatically disabled when this

function is used. Null values are disregarded.

Examples:

rank( sum( Sales ))

rank( sum( Sales ), 2 )

rank( sum( Sales ), 0, 1 )

buzzy996
Master II
Master II

sorry sreenu v,for any help..community is  the best!

Not applicable

Hi NikhilGarg

Check this link you will get the answer with sample example also

Rank function in expression


Not applicable

Ok Dear.