Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
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

Re: Top 2 company over past 3 years and 2 Years

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

MVP
MVP

Re: Top 2 company over past 3 years and 2 Years

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

Re: Top 2 company over past 3 years and 2 Years

No I want top 2 vendor for over 3 Years,

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

MVP
MVP

Re: Top 2 company over past 3 years and 2 Years

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
Contributor III

Re: Re: Top 2 company over past 3 years and 2 Years

Check the attachment if that helps.

Not applicable

Re: Top 2 company over past 3 years and 2 Years

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