Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
phongnnguyen
Contributor II
Contributor II

Max and aggregate

Hi all,

I want to calculate max of sum like example below

dateIDStickerAmount
1T1A100
1T1B200
1T1C300
2T1A200
2T1B100
2T1C400
1T2D2
1T2E3
1T2F5
2T2D8
2T2E7
2T2F1

I want the result is :T1 =  200+100+400=700

T2=8+7+1=16

this means Sum Amount based on each date, and choose Max number for each ID T.

IDAmount
T1700
T215

I used to a set analysis: max(aggr(sum(Amount),Date))

But it doesnt work

1 Solution

Accepted Solutions
niclaz79
Partner - Creator III
Partner - Creator III

Hi, this works for me:

Max(Aggr(Sum(Amount),date, ID))

View solution in original post

5 Replies
YoussefBelloum
Champion
Champion

Hi,

for T1, if you need max(amount) for each date, it will be:

T1= 300 (for date 1) + 400 (for date 2) = 700

for T2:

T2= 5 (for date 1) + 8 (for date 2) = 13

niclaz79
Partner - Creator III
Partner - Creator III

Hi, this works for me:

Max(Aggr(Sum(Amount),date, ID))

YoussefBelloum
Champion
Champion

try this expression:

=sum(aggr(max(Amount),ID,date))

phongnnguyen
Contributor II
Contributor II
Author

It is right, awesome. Thanks so much

niclaz79
Partner - Creator III
Partner - Creator III

Do you mind marking it as correct?