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.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 divide by zero error

Author  Topic 

krish001
Yak Posting Veteran

61 Posts

Posted - 2009-11-03 : 09:55:08
how to get resolve divide by zero error in reports??

iam using =iif(reportitems!AvailableWorkingDays_2.Value=0,"none",(reportitems!ResourceActualWorking_2.Value)/(reportitems!AvailableWorkingDays_2.Value))

iam getting #error in preview

JCirocco
Constraint Violating Yak Guru

392 Posts

Posted - 2009-11-03 : 09:58:03
My guess is the #error is not a divide by zero error.

John
It's a small world (but I wouldn't want to paint it)
Go to Top of Page

krish001
Yak Posting Veteran

61 Posts

Posted - 2009-11-03 : 10:00:12
quote:
Originally posted by JCirocco

My guess is the #error is not a divide by zero error.

John
It's a small world (but I wouldn't want to paint it)



it is divide by zero error iam getting warning
Go to Top of Page

krish001
Yak Posting Veteran

61 Posts

Posted - 2009-11-03 : 10:02:09
quote:
Originally posted by JCirocco

My guess is the #error is not a divide by zero error.

John
It's a small world (but I wouldn't want to paint it)



iif(reportitems!AvailableWorkingDays_2.Value=0,"",(reportitems!ResourceActualWorking_2.Value)/(reportitems!AvailableWorkingDays_2.Value))


i want to show null when it is dividing by zereo
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-11-03 : 10:39:41
add this code to your report, and use this for division


Public Shared Function Divide(Num1 as double, Num2 as double) AS object
IF ISNOTHING(Num2) Or Num2 = 0 Then
Divide = "-"
ELSEIF Num1 = 0 THEN
Divide = 0
ELSE
Divide = Num1*1.0/Num2
END IF
End Function
Go to Top of Page
   

- Advertisement -