4 Replies Latest reply: Jul 19, 2014 5:22 AM by Padma Paida

# SUM 2 fields on 2 conditions...

OK, I have a question re: summing. I want to SUM [Contract Value] when Stage is 'Contract' and add this to the SUM of [Pipeline Value] when Stage is 'Contract Negotiation' or 'Offer Negotiation'.

I've seen conditional sums in here, but they are typically summing one field when multiple conditions exist. Here I need to sum 2 fields when 2 or more conditions exist.

Any help would be greatly appreciated!

• ###### Re: SUM 2 fields on 2 conditions...

Hi Try this code:

=Sum((If(Stage='Contract',ContractValue) and if(Stage='Contract Negotiation' or 'Offer Negotiation',[Pipeline Value]))

• ###### Re: SUM 2 fields on 2 conditions...

Thanks for this!  I just had to tweak the "and" to an "or" and now it works, so I get what I need! Thanks!

• ###### Re: SUM 2 fields on 2 conditions...

Hi James

IF want to SUM [Contract Value] when Stage is 'Contract' and add this to the SUM of [Pipeline Value] when Stage is 'Contract Negotiation' or 'Offer Negotiation'. please see below code try to with this hopefully it will work out for your issue.

=Sum((If(Stage='Contract',ContractValue) and if(Stage='Contract Negotiation' or 'Offer Negotiation',[Pipeline Value]))

• ###### Re: SUM 2 fields on 2 conditions...

Hi James

If use set analysis the syntax would as per below and sum(set analysis is more efficient than ifs

=sum({<Stage={'Contract'}>}[Contract Value])

+ sum({< Stage= {'Contract Negotiation' , 'Offer Negotiation'}>} [Pipeline Value])

Regards