Search code examples
pivot-tableqlikviewranking-functions

Qlikview Pivot Table Top X by week


I have a pivot table with week number (columns) versus product (rows). I want to see the top 10 products, based on sales, per week, a value of 1 would indicate the product is in the top 10. I'm using the expression below and I'm getting the Top 10 sales over all weeks. How do I get a weekly top 10 (each column would have ten values)?

=if(Aggr(Rank(sum([SALES])),PRODUCT)< 11,1,0)


Solution

  • I would say you are almost there, but you need to add another parameter to the Aggr function (like you've said you want the rank by Product and Week, and currently you are only taking Product into account).

    Without knowing the details of your model, the expression would be something like :

    =if(Aggr(Rank(sum([SALES])),PRODUCT,WEEK)< 11,1,0)