Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
Highlighted
capriconuser
New Contributor III

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
Contributor III

Re: top selling products

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

chr(10),

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

 

)

5 Replies
thevingo
Contributor

Re: top selling products

try

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

capriconuser
New Contributor III

Re: top selling products

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
Contributor III

Re: top selling products

try this:

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

capriconuser
New Contributor III

Re: top selling products

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
Contributor III

Re: top selling products

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

chr(10),

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

 

)