1

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)) 
Jamiec
  • 133,658
  • 13
  • 134
  • 193
user6751695
  • 19
  • 1
  • 5

2 Answers2

4

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)) 
Jamiec
  • 133,658
  • 13
  • 134
  • 193
0

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)
Strawberryshrub
  • 3,301
  • 2
  • 11
  • 20