user6751695
user6751695

Reputation: 31

SSRS Expression-Sum two fields

I need to sum two fields but I couldn't.

Can you help me?

=iif(Fields!ABC.Value= "", Nothing, Sum(Fields!PA.Value)) 
=iif(Fields!XYZ.Value= "", Nothing, Sum(Fields!PA.Value))

It does not work that way:

=iif(Fields!ABC.Value= "", Nothing, Sum(Fields!PA.Value)) +
       iif(Fields!XYZ.Value= "", Nothing, Sum(Fields!PA.Value)) 

Upvotes: 1

Views: 6898

Answers (2)

Strawberryshrub
Strawberryshrub

Reputation: 3399

I think what he is looking for is something like this:

=Sum(IIF(Fields!ABC.Value = "", Nothing, Fields!PA.Value)
=Sum(IIF(Fields!XYZ.Value = "", Nothing, Fields!PA.Value)

Upvotes: 0

Jamiec
Jamiec

Reputation: 136219

To sum them I should think you just want to default to 0 rather than Nothing

=iif(Fields!ABC.Value= "", 0, Sum(Fields!PA.Value)) +
   iif(Fields!XYZ.Value= "", 0, Sum(Fields!PA.Value)) 

Upvotes: 4

Related Questions