Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 #Error when using =Iif statement Rate Topic Display Mode Topic Options
Author
 Message
 Posted Thursday, November 1, 2007 3:35 PM
 Forum Newbie Group: General Forum Members Last Login: Tuesday, May 20, 2008 1:07 PM Points: 2, Visits: 3
 I am trying to do basic Reporting Services, because that is all that I know....so if the answer has to do with code and such, please be specific as to what I need because I have not learned that yet :)I am doing the following=iif(sum(Fields!Deqsum.Value) = 0,0,(SUM(Fields!Deqsum.Value)/SUM(Fields!Totsum.Value)))I am getting an #Error when the DeqSum = 0.00 and the Totsum = 0.00I have validated that there are NO nulls in my tables, just zeros. How do I work around this so it gives me a 0% instead of #Error?Thanks so much for any help!Marissa
Post #417666
 Posted Thursday, November 1, 2007 3:52 PM
 SSCertifiable Group: General Forum Members Last Login: Today @ 6:58 PM Points: 7,179, Visits: 15,773
 You have to prevent totsum from being 0, since that is what is causing your divide by zero #ERROR's.If you want that to evaluate to 0 then try:=iif(sum(Fields!Deqsum.Value) = 0,0,(SUM(Fields!Deqsum.Value) *iif(SUM(Fields!Totsum.Value)=0,0,1)/iif(SUM(Fields!Totsum.Value)=0,1,SUM(Fields!Totsum.Value)))) ----------------------------------------------------------------------------------Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #417671
 Posted Thursday, November 1, 2007 3:59 PM
 Forum Newbie Group: General Forum Members Last Login: Tuesday, May 20, 2008 1:07 PM Points: 2, Visits: 3
 THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!!:D
Post #417673
 Posted Wednesday, June 25, 2014 8:30 PM
 Forum Newbie Group: General Forum Members Last Login: Tuesday, December 9, 2014 8:53 PM Points: 3, Visits: 160