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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
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 II
Partner - Master II

=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 II
Partner - Master II

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

SI_NY02
Contributor III
Contributor III
Author

Thank you!