4 Replies Latest reply: Aug 30, 2013 1:32 AM by Ramkumar Ramagopalan

# 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

• ###### Re: Need help with FirstSortedValue

Have you tried this?

Edit:

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

• ###### Re: Need help with FirstSortedValue

may be like this

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

• ###### Re: Need help with FirstSortedValue

Thanks to both of you. It works!!

• ###### Re: Need help with FirstSortedValue

HI

Try like this

I think so,

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