Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help with FirstSortedValue

=FirstSortedValue(distinct [Person],-[Sales])

This expression returns the top sales person based on the Highest Sales value, but I want to retrieve the person with the highest Sum(Sales) value.

e.g.

Person Sales

Rob    6000

John   7000

Rob    5000

John   1000

My expression returns John based on the highest sale 7000. Whereas I expect Rob to be returned because his sum is 11000. Please help.

Thanks,

Ram

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

may be like this

=FirstSortedValue([Person], Aggr(-Sum([Sales]), Person))

View solution in original post

4 Replies
tresesco
MVP
MVP

Have you tried this?

Edit:

Expression corrected: FirstSortedValue(Person, -Aggr(Sum(Sales),Person))

CELAMBARASAN
Partner - Champion
Partner - Champion

may be like this

=FirstSortedValue([Person], Aggr(-Sum([Sales]), Person))

MayilVahanan

HI

Try like this

I think so,

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks to both of you. It works!!