Running Value in SSRS

December2000
December2000 used Ask the Experts™
on
Hi Experts,
I’m trying to get a running total from a decimal column in a dataset based on code below. There is one record that has value of “S” but instead of displaying Length of that one field, it shows #Error.

=RUNNINGVALUE(IIF(Fields!ClassTool.Value = "S",
IIF(Fields!Length.Value > 0,Fields!Length.Value,0),0), SUM, "V_WEB_DP_Item")

I have another expression that is the same as above but instead of “S” it is “C3”. There are two records with value “C3” and it displays the total of the 2 lengths.

Any idea why if only 1 record matches criteria I get #Error but if two or more match criteria I get the sum of the values?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Project Leader
Commented:
Hello,

#Error may be displayed if an error occurs due to data type mismatches in the expression. One option is to convert all operands to same data type as below:

=RUNNINGVALUE(IIF(Fields!ClassTool.Value = "S",
IIF(CDbl(Fields!Length.Value) > CDbl(0),CDbl(Fields!Length.Value),CDbl(0)),CDbl(0)), SUM, "V_WEB_DP_Item")

Thanks,
Harish

Author

Commented:
Excellent!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial