Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm having problems with calculating a Aggr Sum which in theory is simple. The case is as follows:
I have the following table:
Table:
load * Inline [
KeyUH, State Amount
A,1,1000
A ,2,1000
A ,3,4500
B, 1,1000
B, 2,1000
B, 3,7000
B, 4,9000
];
Just need the sum of the amount KeyUH field when the state is the maximum, that is:
A, 3,4500 (3 is the highest state for A)
B, 4,9000 (4 is the highest state B)
and result in 4.500 + 9.000 = 12.500
I am using the following expression: aggr (sum ({<Status = {"$ (= max (State))"}>} Amount) KeyUH)
It does not work properly
Thanks in advance.
The following expression works:
=Sum(Aggr(FirstSortedValue(Amount,-State),KeyUH))
The following expression works:
=Sum(Aggr(FirstSortedValue(Amount,-State),KeyUH))
=sum(aggr(FirstSortedValue(TOTAL <KeyUH> Amount, -State), KeyUH))
Thanks NagaianK, that's what I was looking for.
Regards.