Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Fab62400
Contributor II
Contributor II

Max of both values

Hello,

I've a table like this :

 

Fab62400_0-1590743391404.png

 

I have a table like this. I would like to find the max of "Amount" and also the corresponding "Team" data.
For example :
for the date of 01/08/2013:
the max of Amount is 25000 and the Team is "Alpha".
I know how to find the maximum of Amount but not the Team column with set analisys.

=max ({<[SalesGroup]= {'East'}>} VALUE,1)

 

I would like to display both values.

Thank for your help !

 

3 Solutions

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

you need something like

MaxString( if( aggr(nodistinct  max(Amount), Date) = Amount, Team, null()))

Regards

View solution in original post

tresesco
MVP
MVP

May be a simpler one for Team value like:

=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount)

View solution in original post

sunny_talwar

Just like Max, FirstSortedValue can also show text related to 2nd and 3rd max value

=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 1)
=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 2)
=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 3)

View solution in original post

5 Replies
martinpohl
Partner - Master
Partner - Master

you need something like

MaxString( if( aggr(nodistinct  max(Amount), Date) = Amount, Team, null()))

Regards

tresesco
MVP
MVP

May be a simpler one for Team value like:

=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount)

Fab62400
Contributor II
Contributor II
Author

Thanks it works!

Is it possible to have the 3 max text value  like the   function max(.., 1) max(.., 2) max(.., 3 ) ?

sunny_talwar

Just like Max, FirstSortedValue can also show text related to 2nd and 3rd max value

=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 1)
=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 2)
=FirstSortedValue ({<[SalesGroup]= {'East'}>} Team, -Amount, 3)
Fab62400
Contributor II
Contributor II
Author

Yess !

 

Thank you !