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

Top 2 company over past 3 years and 2 Years

Hello Everyone,

I have a table with following Field

VendorItemSalesyear
ABP12000

2001

BCP230002002

CD

P340002003
DEP445002004
EFP520002005

Then my query is to find Top 2 Vendor over 3 years,please help me out.. if anyone has any solution.

6 Replies
Not applicable
Author

Does that mean, you want Top 2 vendor for each year? Your question is not clear. Please explain

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This is one way:

Top =Max(Aggr(Sum(Sales), Vendor, Year))

2nd =Max(Aggr(Sum(Sales), Vendor, Year), 2)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

No I want top 2 vendor for over 3 Years,

and then in another table top 2 vendor for over 2 Years

jonathandienst
Partner - Champion III
Partner - Champion III

And this is another (eg in calc dimension):

     =If(Rank(Aggr(Sum(Sales), Vendor, Year)) <= 2, Vendor)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
venkatg6759
Creator III
Creator III

Check the attachment if that helps.

Not applicable
Author

I have used different personal edition could you please write the code here..