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: 
txepulin
Contributor II
Contributor II

Rank function

Hello,

As much as I searched, I can't find the answer.

I've a table with a single dimension, StoreCodeDesc, and I want to know the weight of the top 100 of the best selling products on the total sales of each store.

On the one hand I want to know the weight that the Top 100 global has, I use the formula:

Sum ({<ArticleCode = {'= rank (Total Sum (NetAmount)) <= 100'}>} NetAmount) / sum (NetAmount)

For another hand I want to know the weight of the Top 100 of each store with the formula without Total:

Sum ({<ArticleCode = {'= rank (Sum (NetAmount)) <= 100'}>} NetAmount) / sum (NetAmount)

Both formulas give me the same result, the weight of the top 100 global sales of each store, but I don't get the weight of the top 100 of each store.

Any ideas?

Regards

2 Replies
sunny_talwar

For each store, you can try this

Sum(Aggr(If(Rank(Sum(NetAmount)) <= 100, Sum(NetAmount)), Store, ArticleCode))

txepulin
Contributor II
Contributor II
Author

Thanks, it works perfectly.