Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
chandinig
Creator
Creator

how to display top 5 values by using of rank function

Hi..

  How to display top 5 values by using of rank function

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Considering that you have customer and sales data and you want top 5 customers by sales

Create a Straight Table

Use Calculated Dimension

=IF(Aggr(Rank(SUM(Sales),4),Customer)<=5,Customer)

Expression

SUM(Sales)

Use Below in your script:

Load * Inline

[

     Customer, Sales

     A, 100

     B, 120

     C, 300

     D, 400

     E, 75

     F, 50

     G, 125

     H, 2000

     I, 250

];

View solution in original post

3 Replies
MK_QSL
MVP
MVP

Considering that you have customer and sales data and you want top 5 customers by sales

Create a Straight Table

Use Calculated Dimension

=IF(Aggr(Rank(SUM(Sales),4),Customer)<=5,Customer)

Expression

SUM(Sales)

Use Below in your script:

Load * Inline

[

     Customer, Sales

     A, 100

     B, 120

     C, 300

     D, 400

     E, 75

     F, 50

     G, 125

     H, 2000

     I, 250

];

MK_QSL
MVP
MVP

Another Way

Create a Straight Table

Dimension

Customer

Expression

SUM({<Customer = {"=Rank(SUM(Sales),4)<=5"}>}Sales)

balanandam
Creator II
Creator II

I did as suggested. But my problem now is, it is taking top 5 as 100% rather than whole, and dividing them as per the share.

ex:

I need each one of the exact share(%) in the whole sum i.e, SUM(Sales).

Br, Balanandam