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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max Product

I want to determine the best selling product for a region.

I have data like so:

 

RegionProd1Prod2Prod3Prod4Prod5
12923232926
12024392527
12125332220
12034232624
12430343124
22831302328
22532252530
22234233321
22530393530
32631223220
33027242530
329232820

21

I want a table like so:

  

RegionBest Seller
1Prod 3
2Prod 2
3Prod 1

Region 1 gets prod 3 since it sold 152 units, region 2 gets prod 2 since it sold the most at 127 units.

Not sure what the expression needs to be.

Thanks

Labels (1)
3 Replies
swuehl
Champion III
Champion III

Transform your crosstable into a straight table:

CROSSTABLE (Product, Value)

LOAD Region, Prod1, Prod2, Prod3, Prod4, Prod5

FROM YourSource;

Then create a straight table with dimension Region and as expression

=FirstSortedValue(DISTINCT aggr( Product, Region, Product) , -aggr(Sum(Value), Region, Product) )

Not applicable
Author

Is there a way to do this without altering the load?

swuehl
Champion III
Champion III

Is there a reason you want to keep that structure?

Having a straight table is advantegous for almost all kind of analysis.

Have a look at

The Crosstable Load