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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

return the quantity of assets from the max sum(Price) from a category

Hello Community,

This is my database:

CategoryProductPrice
LaptopAsus Zen300
LaptopSony f12x400
LaptopApple Mac Pro800
PCAlienware Pro2000
PCHP Gaming X41500
MouseRazor Diamondback50
KeyboardLogitec Wireless30
MouseLogitec G560
HeadsetCreative GX 880

I want QV to return me quantity of assets considering the max sum(Price) of a Category.

In this case it should return me:

Category = PC and Quantity = 2

This is my expression which i m using. But somehow it is not working correctly.

Concat(DISTINCT {<Category = {"=Aggr(Sum(Price), Category) = Max(TOTAL Aggr(Sum(Price), Category))"}>} Categoy, ', ') & ' \n'

& Max(TOTAL Aggr(count(Category), Category))

Could anyone help me out here?

23 Replies
MK_QSL
MVP
MVP

This one is also working...

thanhphongle
Creator II
Creator II
Author

LOL, now it s working for me as well. I swear I followed your instructions and it still gave me 61 as quantity! But thank you guys anyway !

sunny_talwar

Hahahaha I am glad it finally worked. We need a lot of helpful answers from you on this post and of course a correct answer

MK_QSL
MVP
MVP

I know why it was not working for you... and you was getting 61... Because you was just doing copy paste our expression into your application. But you forgot to change

COUNT({<Category = {"=RANK(SUM([Selling price]),4)=1"}>}Category)

to

COUNT({<Category = {"=RANK(SUM([Selling price]),4)=1"}>}[Serial Number])

Am I right?