Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
techvarun
Specialist II
Specialist II

Display the member with maximum invoice in a text object

Hi,

I have a table with structure

Name    Invoicenumber

aaa          123

aaa         123

aaa          123

bbbb       123

i need to display only the name which processed maximum number of invoices in a text object

Thanks in advance

Regards

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

= FirstSortedValue( aggr(Name,Name)    , aggr(-count(Invoicenumber),Name) )

View solution in original post

7 Replies
techvarun
Specialist II
Specialist II
Author

= FirstSortedValue(Name    , - max(Count(Invoicenumber) )

but it is saying error in expreession

swuehl
MVP
MVP

Try

= FirstSortedValue( aggr(Name,Name)    , aggr(-count(Invoicenumber),Name) )

techvarun
Specialist II
Specialist II
Author

Thanks Swuehl

   It worked like charm

Regards

techvarun
Specialist II
Specialist II
Author

Hi One more Qn.

How to find minimum of average?

= FirstSortedValue( aggr(Name,Name)    , aggr(-min(avg(Invoicenumber)),Name) )




Regards

swuehl
MVP
MVP

What should the avg(Invoicenumber) return [given your above sample data]? 123?

techvarun
Specialist II
Specialist II
Author

Hi swuehl

Not for that data I am using some other and data and found the average of time they are utilizing for processing certain invoices .

and now I need to show the member who is having least average response time (i.e) High Productivity.

= FirstSortedValue( aggr(ModBy,ModBy)    , aggr(min((-avg(Diff))),ModBy) )

Regards

swuehl
MVP
MVP

Then try

= FirstSortedValue( aggr(ModBy,ModBy)    , aggr( avg(Diff),ModBy) )

FirstSortedValue() will return the min value sorted by your sort weight avg(Diff), if you want to get the max, add the minus sign.

And if you can have multiple ModBy's with the same min sort weight, FirstSortedValue won't return anything, to get at least one, add a DISTINCT qualifier:

= FirstSortedValue(DISTINCT  aggr(ModBy,ModBy), aggr( avg(Diff),ModBy) )