expression

  • Hi,

    In one column I am calculating this.

    =Fields!Interview_Completed.Value/Fields!Records_Included.Value

    This is the percentage.

    When this is 0% IT HAS TO BE BALNK. MEANS IT SHOULD NOT SAY 0%. How can we write an expression in ssrs for this?

    Thank you

  • =IIF(Fields!Interview_Completed.Value/Fields!Records_Included.Value = 0, "", Fields!Interview_Completed.Value/Fields!Records_Included.Value)

  • Hello, thats what i wrote. but i needed something different.it is like this.when the denominator is zero it is displaying "Nan"

    i dont wnat this way in the report.

    I have an expression like this in ssrs. It display nothing when

    (Fields!Survey_Completed.Value)/(Fields!Email_Invite_Sent.Value)=0

    But and value when the result of this is some value. But I wanted to have nothing whne the denominator is zero.

    Can anyone help me with this?

    The expression that I have now is this which does not displays what I want.

    =iif((Fields!Survey_Completed.Value)/(Fields!Email_Invite_Sent.Value)=0," ",(Fields!Survey_Completed.Value)/(Fields!Email_Invite_Sent.Value))

    thank you

  • Try this instead

    =IIF(Fields!Records_Included.Value = 0, "", IIF(Fields!Interview_Completed.Value/Fields!Records_Included.Value = 0, "", Fields!Interview_Completed.Value/Fields!Records_Included.Value))

    Or if you use this kind of calculation a lot, many of us do you could go to Report>>Report Properties and choose the Code tab and put something like this function in there:

    Public Function DivideBy(ByVal Exp1, ByVal Exp2)

    If Exp2 = 0 Then

    DivideBy = ""

    Else: DivideBy = Exp1/Exp2

    End If

    End Function

    Then in your SSRS expression you would put

    =code.DivideBy(Fields!Interview_Completed.Value, Fields!Records_Included.Value)

    and it would all work out just fine.

    PS. I found this function code either on this site or elsewhere on the internet. I found it extremely useful and it is now part of my report template.

  • Thanks for Replying me.

  • Hi,

    Custom code gives u more accurate results in your requirment pinky.

    Veeren.

    Thanks & Regards,
    Veeren.
    Ignore this if you feel i am Wrong. 😉

Viewing 6 posts - 1 through 5 (of 5 total)

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