Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
marishnagendran
Creator
Creator

Rank function in expression

Dear All,

Raw Data:

ProductSales
  
A100
B200
C300
D50
E100
F150
A100

 

In Chart Expression Dimension as product and Expression as Sum(Sales)

ProductSum(Sales)
  
A200
B200
C300
D50
E100
F150

 

My Requirement top 3 products in chart using rank function in expression is there any possibilities???

My Output is

ProductSum(Sales)
  
A200
B200
C300

 

1 Solution

Accepted Solutions
sunny_talwar

Try this expression

Sum({<Product = {"=Rank(Sum(Sales)) <= 3"}>}Sales)

View solution in original post

8 Replies
sunny_talwar

Try this expression

Sum({<Product = {"=Rank(Sum(Sales)) <= 3"}>}Sales)
lironbaram
Partner - Master III
Partner - Master III

hi 

you can do it with no need to another expression 

you could go to the dimension and set it to display only 3 values 

and it'll display to you the top 3

marishnagendran
Creator
Creator
Author

It's not working ....

marishnagendran
Creator
Creator
Author

Yeah i Know but for my customization i need in expression level

sunny_talwar

It is working for me

image.png

Channa
Specialist III
Specialist III

=If(Aggr(Rank(Sum(Sales)),product)<=3,Product)

 

it is ur dimension

measure :Sum(sales)

Channa
marishnagendran
Creator
Creator
Author

Yeah It's working...but inside rank function my current year expression is not working

 

FiscalYear = {$(=Max(FiscalYear))}

marishnagendran
Creator
Creator
Author

Now it's working thank you