Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Creator
Creator

Re: Need to get the highest sold product for each week

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
Highlighted
Creator
Creator

Re: Need to get the highest sold product for each week

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

Highlighted
Contributor
Contributor

Re: Need to get the highest sold product for each week

Thanks!!
Exactly what I needed.