Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
marcel_olmo
Partner Ambassador
Partner Ambassador

Maximum value per field

Hi guys,

I have  a table like this :

Company Transaction Id Amount
120 10
1199
2185
2176
3162
3156

And I'd like to get in a table, the maximum possible amount by Transaction Id per Company, that will be --> 10 + 5 + 2 = 17.

This is what I'm trying :

num(sum(  {$ < [Transaction Id] = {$(=max([Transaction Id]))}  >} Amount),'#.##0,00 €')

aggr( num(sum(  {$ < [Transaction Id] = {$(=max([Transaction Id]))} >} Amount ),'#.##0,00 €') , Company )

But I only got the maximum value of the maximum Transaction Id.

I've attached the example.

Do yo know how to get my desired result?

Many thanks in advance!

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do what you want if I have understood you correctly

Sum(Aggr(FirstSortedValue(Amount, -[Transaction Id]), Company))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
Not applicable

Hi Marcel

Here it is

best regards

Chris

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do what you want if I have understood you correctly

Sum(Aggr(FirstSortedValue(Amount, -[Transaction Id]), Company))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks guys!

It worked with firstSortedValue. Thank you guys!

sorted.png

yduval75
Partner - Creator III
Partner - Creator III

=FirstSortedValue(Amount, -[Transaction Id]) is much better !

Thanks Jonathan