Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
capriconuser
Creator
Creator

top selling products

hi

i have several data like this


Name of product amount

product1 1200

product2 1500

product3 1200

product4 1400

product5 1400

product6 1500


now here top 2 products name in textbox like this


product2 , product 6


means i want to get top selling products name  in textbox


how i do this


1 Solution

Accepted Solutions
chinnuchinni
Creator III
Creator III

= concat( aggr(if(rank(sum(amount)) <= 1, [Name of product]), [Name of product]),

chr(10),

  aggr(rank( sum(amount) ), [Name of product] )

 

)

View solution in original post

5 Replies
thevingo
Creator
Creator

try

=Concat(firstsortedValue([Name of Product],-aggr(sum(TOTAL amount),[Name of Product])),',')

capriconuser
Creator
Creator
Author

kindly check updated attachements in question i use your solution but this shows an error

nested aggregation is not allowed..

and secondly i use this but this shows only amount 1500 ... products is not display

='Top Salesperson: '  & firstsortedvalue( products, -Aggr(sum(amount),products)) & ', Sales: ' & num(max(Aggr(sum(amount),products)))

chinnuchinni
Creator III
Creator III

try this:

='Top Product :     '&FirstSortedValue([Name of product],-Aggr(amount,amount)) & '     Sales :  '&FirstSortedValue(amount,-Aggr(amount,amount))

capriconuser
Creator
Creator
Author

this shows only product 2 where i want also product 6 because there is two names associated with 1500 ..

so i want product 2 and product 6.

chinnuchinni
Creator III
Creator III

= concat( aggr(if(rank(sum(amount)) <= 1, [Name of product]), [Name of product]),

chr(10),

  aggr(rank( sum(amount) ), [Name of product] )

 

)