Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
WE ARE LISTENING! New Navigation for Qlik Community, Sept. 26: TELL ME MORE
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])

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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.