# Incorrect value in expression

1. ##### Barry 1 posts
Member since:
Mar 2015

Posted 02 Apr 2015 Link to this post

Hello,

I am using a formula that should be pretty straightforward in a cross tab field.

= IIf((Exec("rowGroup1", Sum(Fields.Field1)) - RunningValue("rowGroup1", Sum(Fields.Field1))) = 0, 0, (Exec("rowGroup1", Sum(Fields.Field2)) - RunningValue("rowGroup1", Sum(Fields.Field2))) / (Exec("rowGroup1", Sum(Fields.Field1)) - RunningValue("rowGroup1", Sum(Fields.Field1))))

The idea is that we are taking the sum of all values and dividing it but the running total. In most scenarios, this is running correctly and the last value is 0 because the running total is equal to the sum of all values. However, in a couple of instances, a negative number is produced and I can't figure out what's going on. I have checked the values of the sum of all vs the running total and it appears that it should calculate to 0. I'm coming close to a deadline and hoping the community may be able to help.

Thanks 1064 posts

Posted 03 Apr 2015 Link to this post

Hello Barry,

The result of the expression is determined by how the Reporting engine works and by the exact set of data rows and their values which are fed to the report.
In order to determine the cause of this behavior we will need to review a runnable report with sample data exhibiting it.

Also you can investigate on your end by placing each of the below expressions in a separate text box:

= Exec("rowGroup1", Sum(Fields.Field1))

= RunningValue("rowGroup1", Sum(Fields.Field1))

= Exec("rowGroup1", Sum(Fields.Field2))

= RunningValue("rowGroup1", Sum(Fields.Field2))

and check each partial result for something which is off.

Regards,