Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

syntax

is their any syntax to get top values

say top 5 from a lot of 50

if yes what is it

thanks'

10 Replies
MK_QSL
MVP
MVP

Consider that you have below script...

Sales:

Load * Inline

[

  Customer, Sales

  A, 100

  B, 120

  C, 200

  D, 90

  E, 45

  F, 65

  G, 150

  H, 200

  I, 100

  J, 150

];

There are multiple ways to get TOP 5...

1) TOP 5 - Dimension Limit

Create a Straight Table

Dimension

Customer

Expression

SUM(Sales)

Dimension Limit

Tick Restrict which values are displayed using the first expression

Show Only Largest 5 Values

2) Sales - TOP 5 Calculated Dimension

Create a Straight Table

Dimension - Use Calculated Dimension

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

Expression

SUM(Sales)

3) TOP 5 - Set Analysis

Create a Straight Table

Dimension

Customer

Expression

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