Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to use sum multiple field value

Hi,

I have requirement where I want to fetch more then one field value in to single expression.

In below mention example there is more then one division and for each division value stored on there respacted field.

I have tired single statement and found result is correct.

=sum({$<DIVISION ={'L'}>} GROSSWT)

But when I am using OR I am getting -1 as value.

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

So now I am not sure my method of using OR is correct ?

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Check with this

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

or

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


MayilVahanan

Hi

Try like this

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

Alt() function used because, if

sum({$<DIVISION={'L'}> GROSSWT) OR sum({$<DIVISION ={'D'}>} PCS) is null values means, may be null appear..

i.e. '-' (null value) +  45 gives null value.. to avoid this alt() function used here..

or

try like this

Rangesum(sum({$<DIVISION={'L'}> GROSSWT),

sum({$<DIVISION ={'D'}>} PCS))

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Vegar
MVP
MVP

Your -1 = TRUE stating that Expression 1 OR Expression 2 are TRUE.

Not sure what you want to accomplish, but maybe this is what you want to do:

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

Best regards

Vegar Lie Arntsen

QlikView consultant at egbs consulting ab http://egbs.se

Blog (in Swedish): http://bi-effekten.se