Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
SI_NY02
Contributor III
Contributor III

Sum values based on the max of another field

I'm trying to sum the quantity of based on the most recent activity. For example using the chart below sum the qty for each campaign based on the highest "purchased period" only.

Campaign Purchase period Qty

A 30 10

A 30 5

B 30 20

B 60 30

C 30 20

C 60 30

C 90 40

Answer should be:

A = 15

B = 30

C = 40

Labels (2)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

=Sum(Aggr(If([Purchase Period] = Max(TOTAL <Campaign> [Purchase Period]), Sum(Qty)), Campaign, [Purchase Period]))

View solution in original post

2 Replies
BrunPierre
Partner - Master
Partner - Master

=Sum(Aggr(If([Purchase Period] = Max(TOTAL <Campaign> [Purchase Period]), Sum(Qty)), Campaign, [Purchase Period]))

SI_NY02
Contributor III
Contributor III
Author

Thank you!