Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted

may be like this

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

View solution in original post

4 Replies
Highlighted
MVP
MVP

Have you tried this?

Edit:

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

Highlighted

may be like this

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

View solution in original post

Highlighted

HI

Try like this

I think so,

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

Thanks & Regards,
Mayil Vahanan R
Highlighted
Not applicable

Thanks to both of you. It works!!