I think you're likely getting a datatype mismatch in the aggregate; SSRS can't handle implicit conversions in these sort of IIf
/aggregate expressions.
In your expression, 0
will be treated as an int, and assuming the underlying data type of Fields!WEIGHT.Value
is decimal or double, this will throw a runtime error - if you preview in BIDS it should actually display the error.
To get around this you need to make sure the two IIf
results have the same datatype - something like:
=SUM(IIF(Fields!RowNumber.Value = 1, Fields!WEIGHT.Value, 0.0))
or
=SUM(IIF(Fields!RowNumber.Value = 1, Fields!WEIGHT.Value, CDec(0)))
or
=SUM(IIF(Fields!RowNumber.Value = 1, Fields!WEIGHT.Value, CDbl(0)))
Depending on the underlying datatype you may have to try a few combinations but hopefully one of the examples will work correctly,