# Sum of multiple field value

Hi,

how to sum multiple field value into single expression.

=sum({\$<DIVISION ={'L'}>} GROSSWT) OR sum({\$<DIVISION ={'D'}>} PCS)

In above mention example, If I am using first part I am able to see the sum of division "L" on my expression but when I am addting OR for second value my calculation give me -1 as value.

Any idea why ? and if any other way to do that.

• ###### Re: Sum of multiple field value

Are you maybe looking for

=sum({\$<DIVISION ={'L'}>} GROSSWT) + sum({\$<DIVISION ={'D'}>} PCS)

or using rangesum

=rangesum(sum({\$<DIVISION ={'L'}>} GROSSWT),sum({\$<DIVISION ={'D'}>} PCS) )

?

OR is a logical operator and will return either -1 (true) or 0 (false)

Hope this helps,

Stefan

• ###### Re: Sum of multiple field value

wat is the complete expr: any if expr ?

• ###### Re: Sum of multiple field value

Hi

try the below expression

=if(DIVISION='L',sum(GROSSWT),

if(DIVISION='D',sum(PCS),null()))

• ###### Re: Sum of multiple field value

Hi

below i give sample exp

if(empno=1,11,

if(empno=2,22,

if(empno=3,33,

If(empno=4,44,55)

)))

in the above exp if empno=1 then it give 11,

for 2 it show 22,for 3 give 33,for 4 give 44

otherwise give 55 for remaining values.

below is result table

• ###### Re: Sum of multiple field value

Try this.

Sum(if(Wildmatch(DIVISION,'L'),GROSSWT,if(wildmatch(DIVISION,'D'),PCS)))

Regards,

Kaushik Solanki

• ###### Re: Sum of multiple field value

Try this,

Sum(if(DIVISION ='L',GROSSWT,if(DIVISION='D',PCS)))

Regards,

Kaushik Solanki

• ###### Re: Sum of multiple field value

Thanks to you all.

With below mention expression I was able to get reply.

sum(if(DIVISION='D', PCS,GROSSWT))