Search

Advertisements

SSRS - Divide by Zero error - Myth of IIF

In SSRS , IIF evaluates both True and False part irrespective of condition imposed .

Because of that , expressions using IIF will lead us to error in some cases .

Two common scenarios where IIF causes problem :

i. ) Divide by zero .
ii ) Argument 'Month' is not a valid value .

i . )  Divide by zero :


Refer below two MSDN blogs for explanations on how IIF causes divide by zero error and workaround for the same.

http://blogs.msdn.com/b/sqlforum/archive/2011/02/28/faq-why-does-the-attempted-to-divide-by-zero-error-still-happen.aspx

http://blogs.msdn.com/b/bwelcker/archive/2006/09/26/end-of-amnesia-_2800_avoiding-divide-by-zero-errors_2900_.aspx



ii ) Argument 'Month' is not a valid value :


Refer this link for example and explanations on how IIF causes "Argument Month is not a valid value" error and workaround for the same .

Here is the Microsoft Connect for SSRS IIF - Divide by zero error -
http://connect.microsoft.com/SQLServer/feedback/details/729872/ssrs-iif-divide-by-zero-error 

See Also:


No comments:

Advertisements