Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Identifying the group with the max value


Hi,

i have teh following table:

Group         Sales

Sports        50

Sports1      100

sports2       30

i have 2 text objects in which i have 2 show the group with the maximum sales and the sales for that particular group

Maximum sales can be obtained using the below expression:

=Num(Max(Aggr(Sum(Sales), Group)), '###,##0')

what would be the expression for finding its corresponding group (in this case sports1)

thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hi Yousuf

Is this what you need?

=Only({<Sales = {"$(=Max(Sales))"}>} Group)

Lukasz

View solution in original post

4 Replies
Not applicable
Author

Hi Yousuf

Is this what you need?

=Only({<Sales = {"$(=Max(Sales))"}>} Group)

Lukasz

Not applicable
Author

Hi,

There would be FirstSortedValue but it would return null if more than 1 group had achieved the max sales.

You can obtain a concatenation of all the winning groups like this:

=Concat({<Group={"=Sum(Sales)=Max(TOTAL Aggr(Sum(Sales), Group))"}>} DISTINCT Group,', ')

Winning groups are separated by ', ' only if there is more than 1. This formula would also work without sales being summed by group in the table.

Hope this helps.

Not applicable
Author

Thanks Likasz

Not applicable
Author

Thanks pdecalan