Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

Show max with help of Aggr()

Hi Folks,

i got a case, my table does look  the following (please see attached screenshot),

i want to show the sum (Bestand) in depending on max of (W_Zeit)

for example:

Artikelnr   W_Zeit   Bestand

1500          280          300

1500          280          350

1500          240          120

1600          140           45

1600          140           64

1600          120           100

Output should look like this:

Artikelnr   W_Zeit   Bestand

1500          280          650

1600          140          109

i am using this expression: sum(aggr(sum({<W_Zeit = {"$(=MAX(W_Zeit))"}>}Bestand),Artikelnr)) but it does not work

does anybody have any idea, how to resolve this issue

Thanks a lot

Beck

1 Solution

Accepted Solutions
sunny_talwar

May be try this

FirstSortedValue(Aggr(Sum(Bestand), Artikelnr, W_Zeit), -Aggr(W_Zeit, Artikelnr, W_Zeit))

View solution in original post

5 Replies
sunny_talwar

May be try this

FirstSortedValue(Aggr(Sum(Bestand), Artikelnr, W_Zeit), -Aggr(W_Zeit, Artikelnr, W_Zeit))

beck_bakytbek
Master
Master
Author

Good Morning Sunny,

again you saved my day, thanks a lot for your time and help

Thanks a lot

Beck

beck_bakytbek
Master
Master
Author

Hi Sunny

your solution does work great. i have a question.

how can i show the total sum of my value, now i have only the max value 650 as sum, how can i show 1196 as sum of my values (please see attached screenshot)

case solution.PNG

Beck

sunny_talwar

Try this

Sum(Aggr(FirstSortedValue(Aggr(Sum(Bestand), Artikelnr, W_Zeit), -Aggr(W_Zeit, Artikelnr, W_Zeit)), Artikelnr))

beck_bakytbek
Master
Master
Author

Sunny thanks a lot for your help and time

it does work great