none
divided by zero error message RRS feed

  • Question

  • Hi

    i have a cell which showing #Error and it due to the value divide by zero. is there anyway to hide the #Error message?



    • Edited by kjleong Monday, September 26, 2016 2:43 AM
    Monday, September 26, 2016 2:41 AM

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 'Mark as Answer' button if a post solves your problem! :)

    Monday, September 26, 2016 4:23 AM

All replies

  • SET ANSI_WARNINGS on/Off;  

    When set to ON, the divide-by-zero and arithmetic overflow errors cause the statement to be rolled back and an error message is generated. When set to OFF, the divide-by-zero and arithmetic overflow errors cause null values to be returned. The behavior in which a divide-by-zero 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/en-us/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
    Monday, September 26, 2016 2:58 AM
  • 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 'Mark as Answer' button if a post solves your problem! :)

    Monday, September 26, 2016 4:23 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) )


    • Edited by TUSG Monday, September 26, 2016 5:54 AM
    • Proposed as answer by TUSG Monday, September 26, 2016 7:58 AM
    • Unproposed as answer by TUSG Monday, October 3, 2016 7:28 PM
    • Proposed as answer by TUSG Monday, October 3, 2016 7:28 PM
    Monday, September 26, 2016 5:42 AM