Divide By zero error

  • Hi All,

    I have this expression :

    ((Fields!Number_of_Instalments.Value - 1)* Fields!Admin_Fee.Value)+ (Fields!Admin_Fee.Value / Fields!Monthly_Payment.Value * Fields!Final_Amount.Value)

    The issue is that where the monthly Payment is 0, it will result to #error. I want to be able to return zeros for all the monthly payment that is zero instead of #error.

    Thanks,

    E.O

  • I just solved it by using the expression:

    ((Fields!Number_of_Instalments.Value - 1)* Fields!Admin_Fee.Value)+ (Fields!Admin_Fee.Value / iif(Fields!Monthly_Payment.Value * Fields!Final_Amount.Value = 0,1,Fields!Monthly_Payment.Value * Fields!Final_Amount.Value))

    EO

  • This is a common enough occurrence in the real world that I built a function and embedded it into my report template so it is built into all my reports.

    http://www.bidn.com/blogs/Daniel/ssas/1245/divide-by-zero-tweak

    Make sure to read my comment below for instructions on how to embed the code in your report and to call the code from an expression.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply