Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ShadowsZD
Contributor
Contributor

Need to get the highest sold product for each week

Hello, I have my data similar to this:

clipboard_image_0.png


Where I have multiple stores, selling various products, on different weeks.

What I need is a table where I have the product which sold the most during each week, like this:

clipboard_image_1.png


The closest I got was

Sum( {$<Sales = {$(=max(Sales))}>} Sales)

But this only gives me the max overall. I need the max for every week.

Keep in mind I have multiple products, the example above is just sample data.

Thanks!

Labels (3)
1 Solution

Accepted Solutions
Victor_Alumanah
Creator
Creator

Dimension: Week

Expression:

Top Sales     =aggr(max(Sales),Week)

 

Top Product   =FirstSortedValue(DISTINCT aggr( Product, Week, Product) , -aggr(Sum(Sales), Week, Product) )

While we teach we learn

View solution in original post

2 Replies
Victor_Alumanah
Creator
Creator

Dimension: Week

Expression:

Top Sales     =aggr(max(Sales),Week)

 

Top Product   =FirstSortedValue(DISTINCT aggr( Product, Week, Product) , -aggr(Sum(Sales), Week, Product) )

While we teach we learn
ShadowsZD
Contributor
Contributor
Author

Thanks!!
Exactly what I needed.