Answered by:
divided by zero error message
Question

Answers

Hi kjleong
To handle divide by zero value in ssrs, You have to write the following expression.
Eg :
you have a field value Fields!Amount.Value and Fields!Base.Value, you have to divide (Fields!Amount.Value /Fields!Base.Value)
if the Fields!Base.Value =0. So you report will display #Error. ie(Amountvalue /0 = infinity)
Write the below expression.
=iif(( Fields!Base.Value= 0 or isnothing( Fields!Base.Value)),0,(Fields!Amount.Value/ Fields!Base.Value))
Regards, Gayathri devi P.S. : Please click the &amp;amp;amp;amp;#39;Mark as Answer&amp;amp;amp;amp;#39; button if a post solves your problem! :)
 Proposed as answer by Olaf HelperMVP Monday, September 26, 2016 7:06 AM
 Marked as answer by Xi JinModerator Thursday, October 6, 2016 9:26 AM
All replies

SET ANSI_WARNINGS on/Off;
When set to ON, the dividebyzero and arithmetic overflow errors cause the statement to be rolled back and an error message is generated. When set to OFF, the dividebyzero and arithmetic overflow errors cause null values to be returned. The behavior in which a dividebyzero or arithmetic overflow error causes null values to be returned occurs if an INSERT or UPDATE is tried on a character, Unicode, or binary column in which the length of a new value exceeds the maximum size of the column. If SET ANSI_WARNINGS ON, the INSERT or UPDATE is canceled as specified by the ISO standard. Trailing blanks are ignored for character columns and trailing nulls are ignored for binary columns. When OFF, data is truncated to the size of the column and the statement succeeds.
https://msdn.microsoft.com/enus/library/ms190368.aspx?f=255&MSPPError=2147217396
Please click Mark As Answer if my post helped.
 Edited by AV111 Thursday, January 5, 2017 2:45 AM remove link

Hi kjleong
To handle divide by zero value in ssrs, You have to write the following expression.
Eg :
you have a field value Fields!Amount.Value and Fields!Base.Value, you have to divide (Fields!Amount.Value /Fields!Base.Value)
if the Fields!Base.Value =0. So you report will display #Error. ie(Amountvalue /0 = infinity)
Write the below expression.
=iif(( Fields!Base.Value= 0 or isnothing( Fields!Base.Value)),0,(Fields!Amount.Value/ Fields!Base.Value))
Regards, Gayathri devi P.S. : Please click the &amp;amp;amp;amp;#39;Mark as Answer&amp;amp;amp;amp;#39; button if a post solves your problem! :)
 Proposed as answer by Olaf HelperMVP Monday, September 26, 2016 7:06 AM
 Marked as answer by Xi JinModerator Thursday, October 6, 2016 9:26 AM

Here's a key to remember:
In your field expression, you will need two IF and ELSE conditions. First to display nothing/blank when divide by zero error occurs (i.e. denominator =0). Second, to replace your denominator to 1 when it has zero value. 0/1 can be evaluated and is equal to 0. Whereas, 0/0 is undefined.
=IIF ( Denominator = 0, Nothing, Numerator / IIF( Denominator = 0, 1, Denominator) )