Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Finding string attached to Max value

Hi,

I am trying to build a KPI where the KPI displays the name of the customer of which a firm charges the highest amount of hours of service, as well as the actual amount of hours charged over a period of time. Since I am really new to Qlik, and after extensive searching led nowhere, I now turn to the community for help. An example of my table is as follows:

Name              Hours charged during period (ChgHr)

Company A     125

Company B     345

Company C     255

The hours charged during period is calculated with: Max(aggr(Sum(ChgHr),Name)) and returns 345.

My question(s) is(are): What expression do I write under label to find the name, and present it as a string, of the company tied to the maximum value of hours charged (ChgHr)? Is it even possible?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

FirstSortedValue(Name, -Aggr(Sum(ChgHr), Name))

View solution in original post

3 Replies
sunny_talwar

Try this

FirstSortedValue(Name, -Aggr(Sum(ChgHr), Name))

Anonymous
Not applicable
Author

Thanks Sunny, that worked swell.

Cheers

Digvijay_Singh

May be, try this -

=Only({<ChgHr={$(=Max(Aggr(Sum(ChgHr),Name)))}>}Name)