Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Akina0929
Creator
Creator

How to show highest sale and product name in text box?

HI Community,

   I have product name and sales, I want to show highest sale and product name in text box . how can i achieve please help me.

Regards

Anji

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use the aggr() function. For example, if you do not want to make any further distinction (between years, or just for last or current year etc.), you can use this one to get the maximum sales:

=Max(Aggr(Sum(Sales), Product))

If you want to know the name of the product that did best, use this expression:

=FirstSortedValue(Product, -Aggr(Sum(Sales), Product))

If you want to find out why and how this works, you can read this highly instructive treatment: QlikView Technical Brief - AGGR.docx

View solution in original post

6 Replies
hhajjali
Contributor III
Contributor III

Hello

You may use the following expression:

if ([highest sale]= max ([highest sale]), [product name] & ':' & [highest sale])


regards

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use the aggr() function. For example, if you do not want to make any further distinction (between years, or just for last or current year etc.), you can use this one to get the maximum sales:

=Max(Aggr(Sum(Sales), Product))

If you want to know the name of the product that did best, use this expression:

=FirstSortedValue(Product, -Aggr(Sum(Sales), Product))

If you want to find out why and how this works, you can read this highly instructive treatment: QlikView Technical Brief - AGGR.docx

isingh30
Specialist
Specialist

For Product -

= firstsortedvalue(Product, Sales)

Thanks.

isingh30
Specialist
Specialist

= firstsortedvalue(Product, -Sales)

capriconuser
Creator
Creator

hi ..

i have top 2 product which has highest amount i use your query but this shows nothing

siddharthsoam
Partner - Creator II
Partner - Creator II

Hi need help 

FirstSortedValue(Product,aggr(sum(Sales),Product)) is not returning any name though FirstSortedValue(Product,-aggr(sum(Sales),Product)) is giving me the minimum sales product

 PFA of the finance file used