Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik1_User1
Specialist
Specialist

Please help with Cumulative sales

Hi,

Please help with below query.
Country    Product    Sales

USA            Motors        500

USA            Spare          500

USA           Keys           300

USA            Tyres          200

USA          Soaps         600

IND          Soaps         300

IND          Micher         200

IND            Spare          500

IND           Keys           400

UK          Raw Parts    400

 

 

Labels (3)
1 Solution

Accepted Solutions
MatheusC
Specialist II
Specialist II

You'll need the rank function.

Rank(Sum(Sales), 4) <= 3

For the value of the top 3 products in each country, you can work with the total() qualifier and the aggr().

Sum(Sales)
/
Sum(TOTAL <Country>aggr(If(Rank(Sum(Sales), 4) <= 3, Sum(Sales)),Country, Product))


- Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

2 Replies
MatheusC
Specialist II
Specialist II

You'll need the rank function.

Rank(Sum(Sales), 4) <= 3

For the value of the top 3 products in each country, you can work with the total() qualifier and the aggr().

Sum(Sales)
/
Sum(TOTAL <Country>aggr(If(Rank(Sum(Sales), 4) <= 3, Sum(Sales)),Country, Product))


- Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Today is my lucky day! Every question I read, is covered as an exercise in my Qlik Expert class, or in my Advanced Development Techniques session at the Masters Summit for Qlik 🤣🤣🤣

To show top 3 products for each Country, I'd recommend the following calculated Dimension for the Product:

AGGR(IF(Rank(sum(Sales), 4) <= 3, Product), Country, Product)

Cheers,

Oleg Troyansky

Ask me about Qlik Sense Expert Class!