Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
yipchunyu
Creator
Creator

No of Unit for the top product (based on sale amount)

I am working on a new dashboard with KPIs

It will included:
1. Top selling product's sale amount
=Max(Aggr(Sum(Amount), Product_Name))

2. The selling product name 

=FirstSortedValue(Product_Name, -Aggr(Sum(Amount), Product_Name))

But how can I get the sum(no of unit) for this product?  

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

=Sum({<PD_Product_Name = {'$(=FirstSortedValue( PD_Product_Name , -Aggr(Sum(ANP_USD), PD_Product_Name)))'}>} CASE_COUNT)

View solution in original post

4 Replies
Anil_Babu_Samineni

Perhaps this?

Sum({<Product_Name = {"=FirstSortedValue(Chr(39) & Product_Name & Chr(39), -Aggr(Sum(Amount), Product_Name))"}>} [No Of Unit])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
yipchunyu
Creator
Creator
Author

I tried it by substitute with my field names but it returns 0 all the time.  Anything I did wrong?

=Sum({<PD_Product_Name = {"=FirstSortedValue(Chr(39) & PD_Product_Name & Chr(39), -Aggr(Sum(ANP_USD), PD_Product_Name))"}>} CASE_COUNT)

tresesco
MVP
MVP

Try like:

=Sum({<PD_Product_Name = {'$(=FirstSortedValue( PD_Product_Name , -Aggr(Sum(ANP_USD), PD_Product_Name)))'}>} CASE_COUNT)

yipchunyu
Creator
Creator
Author

It works well.  Great thx.