Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
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

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

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