|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 6:36 PM
Points: 52,
Visits: 120
|
|
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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 8:36 AM
Points: 2,681,
Visits: 2,423
|
|
=IIF(Fields!Interview_Completed.Value/Fields!Records_Included.Value = 0, "", Fields!Interview_Completed.Value/Fields!Records_Included.Value)
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 6:36 PM
Points: 52,
Visits: 120
|
|
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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 8:36 AM
Points: 2,681,
Visits: 2,423
|
|
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.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 6:36 PM
Points: 52,
Visits: 120
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, March 21, 2013 5:54 AM
Points: 433,
Visits: 199
|
|
Hi,
Custom code gives u more accurate results in your requirment pinky.
Veeren.
Thanks & Regards, Veeren. Ignore this if you feel i am Wrong.
|
|
|
|