Sunday, February 19, 2012

Attempted to divide by zero

I have the following expression as a Calculated Field:
=IIf(Fields!PROJ_Y.Value <> 0 Or Not Fields!PROJ_Y.Value Is Nothing,
((Fields!PROJ_Y.Value-Fields!ACTUAL_Y1.Value)/Fields!PROJ_Y.Value),
0)
and I get the error "The Value expression for the field â'GROWTH_Yâ' contains
an error: Attempted to divide by zero." when I run the report. Obviously the
If statement is written to avoid the division by zero, so I am not sure how
this would happen.
BJI was able to resolved this issue by writing a custom function to handle the
division instead of the IIf statement.
BJ
"bjkaledas" wrote:
> I have the following expression as a Calculated Field:
> =IIf(Fields!PROJ_Y.Value <> 0 Or Not Fields!PROJ_Y.Value Is Nothing,
> ((Fields!PROJ_Y.Value-Fields!ACTUAL_Y1.Value)/Fields!PROJ_Y.Value),
> 0)
> and I get the error "The Value expression for the field â'GROWTH_Yâ' contains
> an error: Attempted to divide by zero." when I run the report. Obviously the
> If statement is written to avoid the division by zero, so I am not sure how
> this would happen.
> BJ|||I think you just needed to replace the 'Or' with an 'And'
~ Magendo_man
"bjkaledas" wrote:
> I was able to resolved this issue by writing a custom function to handle the
> division instead of the IIf statement.
> BJ
> "bjkaledas" wrote:
> > I have the following expression as a Calculated Field:
> >
> > =IIf(Fields!PROJ_Y.Value <> 0 Or Not Fields!PROJ_Y.Value Is Nothing,
> > ((Fields!PROJ_Y.Value-Fields!ACTUAL_Y1.Value)/Fields!PROJ_Y.Value),
> > 0)
> >
> > and I get the error "The Value expression for the field â'GROWTH_Yâ' contains
> > an error: Attempted to divide by zero." when I run the report. Obviously the
> > If statement is written to avoid the division by zero, so I am not sure how
> > this would happen.
> >
> > BJ

No comments:

Post a Comment