Discussion Board for collaboration related to QlikView App Development.
I want to do this in a text object.
How do I find the max value of a field, then display the corresponding value of that record under another field?
Ex: Find max(sales), then display the salesman responsible for that sale.
How about the second-place salesman?
Go to Solution.
You can probably use Firstsortedvalue() for this, maybe like
=FirstSortedValue( salesman, -aggr( sum(sales), salesman))
and for second place
=FirstSortedValue( salesman, -aggr( sum(sales), salesman),2)
View solution in original post
Thanks! This is what I needed. Just one question... What is the - operator in front of aggr for?
It just negates the expression results of the aggr() function (you could of course also write: aggr( -sum(sales),salesman)
The FirstSortedValue() function returns the salesman with the smallest sort weight, if you want to return the largest / max(sales), use a negative sum of sales.
Hope this makes sense,