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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
awalhashim
Contributor II
Contributor II

Sum of aggr function with condition

Hi i have a set of data with a duplication. Now would like to sum a price.

the situation is like this:

1. Book -> Purchase

2.Book -> Purchase -> Cancel

3. Book -> Purchase -> Terminate

 

if i select Book, it is correct to use sum(aggr()).

But, if i select Purchase, i would like to exclude cancel and terminate from the sum.

Please help.

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Not entirely sure, but may be you need this

If(status = 'purchase',
sum(Aggr(Only({<saleid = e({1<status = {'cancel', 'terminate'}>})>}price),saleid)),
sum(Aggr(price,saleid)))

View solution in original post

2 Replies
sunny_talwar
MVP
MVP

Not entirely sure, but may be you need this

If(status = 'purchase',
sum(Aggr(Only({<saleid = e({1<status = {'cancel', 'terminate'}>})>}price),saleid)),
sum(Aggr(price,saleid)))
awalhashim
Contributor II
Contributor II
Author

Thank you Sunny, u have been very helpful. Thank you so much