Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
hector_munoz
Specialist
Specialist

Name of the best SalesMan

Hi guys,


I need to put the name of the best Salesman (the one who sales the greatest amount) in a text box. I have used the following expression:


=FirstSortedValue(Salesman, Aggr(Sum([Total Sales]), Salesman), Count(DISTINCT Salesman))


It works but is not as smart as I would like. For example, I have to put a third parameter: Count(DISTINCT Salesman), to get the last position in the list of salesmen by sales as it is ordered in ascending order...


Sure that a better way exists... Any idea???


Come on, it is friday... 😉


Regards,

H

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Try

=FirstSortedValue(Aggr(Salesman, Salesman), -Aggr(Sum([Total Sales]), Salesman))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

Try

=FirstSortedValue(Aggr(Salesman, Salesman), -Aggr(Sum([Total Sales]), Salesman))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
stabben23
Master
Master

Hi Héctor,

try With rank like this:  IF(aggr(rank(sum(Sales)),Saleman)=1,Salesman)

or try with this, a - infront of the aggr: FirstSortedValue(Salesman, - aggr(sum(Sales),Salesman))

 

dsharmaqv
Creator III
Creator III

hector_munoz
Specialist
Specialist
Author

Hi,

Thanks to all! Very good solutions all of them!

Regards,

Héctor