Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AndersGS
Contributor III
Contributor III

Show best selling ColorCode of article Total

Hi,

In a QlikView straight table I'm showing the top 5 best selling articles based on it's total Sales value yesterday.
In a separate column I want to display the top 1 selling colorcode within each of the top 5 Articles. 

The fields are : 'Article', 'ColorCode' and the variable 'vSales_LD' 

My Goal:

Article$(vSales_LD)Top 1 selling ColorCode
07409200 00099
07203100 00092
0510350 00033
0771225 00094
0741210 00096

 

Table with all Articles with each ColorCode sold yesterday:

ArticleColorCode$(vSales_LD)
0740999150 000
072039275 000
074093350 000
051039940 000
072032625 000
077129420 000
051039210 000
07412968 000
07712265 000
07412992 000

 

We are running QlikView 11.20.13707.0

Thanks a lot
Anders

Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

Hi Anders,

Try like below in chart expression

FirstSortedValue(ColorCode, -Aggr($(vSales_LD), Article, ColorCode))

It will gives the ColorCode which contains high sales for that articles

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

5 Replies
MayilVahanan

Hi Anders,

Try like below in chart expression

FirstSortedValue(ColorCode, -Aggr($(vSales_LD), Article, ColorCode))

It will gives the ColorCode which contains high sales for that articles

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Taoufiq_Zarra

@AndersGS  If I understood correctly

for this input :

Capture.PNG

straight table :

dimension Article

Expression 1 for example Sum(Sales)

new Expression :

=FirstSortedValue(ColorCode,-Sales)

 

output:

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
AndersGS
Contributor III
Contributor III
Author

Hi Taoufiq,

Thanks for your quick reply. I'm trying with =FirstSortedValue(ColorCode,-$(vSales_LD)) but It throws an error:
"Nested aggregation not allowed".  The variable 'vSales_LD'  is Sum ({$<#Date_O={1},%Type={'O','C','I','IC'},_LD={1}>} mcAmount / EXC.RATE).

Regards
Anders

AndersGS
Contributor III
Contributor III
Author

Hi mayilvahanan,

Thanks for your quick reply. This expression returns "Errors in expression" unfortunately, do we miss any parentheses or will this not work with my variable (please see my reply to Taoufiq for more details)?

Regards
Anders

AndersGS
Contributor III
Contributor III
Author

Hi again, 

Sorry for the delay in checking back on this, I retried your solution today and it worked! 

Many thanks

Anders