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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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