Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jbphoenix
Yak Posting Veteran
68 Posts |
Posted - 2009-11-27 : 11:33:06
|
I have a report that has to do some calculations in some textboxes. I'm stuck because of divide by zero errors. I don't have #error to be displayed. I'd rather have NA. Here is the formula I have right now. -((Fields!CurrXdayDollars.Value/Fields!CurrOutsDollars.Value) - (Fields!PrevXdayDollars.Value/Fields!PrevOutsDollars.Value))*10000Some of the boxes display #error because either CurrOutsDollars or PrevOutsDollars are zero. If I change the formula to - =IIf(Fields!CurrOutsDollars.Value = 0, "NA", IIf(Fields!PrevOutsDollars.Value = 0, "NA", ((Fields!CurrXdayDollars.Value/Fields!CurrOutsDollars.Value) - (Fields!PrevXdayDollars.Value/Fields!PrevOutsDollars.Value))*10000))I still get the #error. Is there a way to get around this?Thanks |
|
JCirocco
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-11-27 : 15:03:05
|
Looks right to me but try some of these...Change your expression above from "NA" to some very obvious numeric value like 9999999. Did the #error's change to 9999999?Change SQL to do Where CurrOutsDollars <> 0 AND PrevOutsDollars <> 0 and see if you still get the #error. Might help point you in the right direction.Sorry I'm not more helpJohnIt's a small world (but I wouldn't want to paint it) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-28 : 02:06:12
|
=IIf(Fields!CurrOutsDollars.Value = 0 Or Fields!PrevOutsDollars.Value = 0, 0, IIf(Fields!CurrOutsDollars.Value = 0 Or Fields!PrevOutsDollars.Value = 0,0,((Fields!CurrXdayDollars.Value/Fields!CurrOutsDollars.Value) - (Fields!PrevXdayDollars.Value/Fields!PrevOutsDollars.Value)))*10000) |
|
|
|
|
|