I am using the following expression to work out a percentage:
=Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name")
Days.Value is showing as 0 however in a few of my results instead of reading 0% in my percentage column it is actually reading NaN (Not a Number).
Does anyone know the exact expression forumla i need and where I should paste it in my current expression to say "Where NaN is showing, put a '0' instead?"
(See image)
The best solution to resolve this problem is to create a custom function. IsNothing() is used to avoid #Error and check whether the divisor or the dividend are 0 to avoid NaN and Infinity. Next you can update the fields textbox properties to make the number display as a percentage.
If we are getting the data from a Database, we can use ISNull or COALESCE function to replace Null values with values we would like. But if we want to replace the Null/Blank values in SSRS Report, we need to use IIF and Isnothing functions in expressions.
Value = “CA”, “Bold”, “Italic”) SSRS iif statement The format of the IIF() statement is as follows: =IIF(Expression, Condition set when the expression is true, Condition set when the expression is false) It should be a Boolean expression, according to parameter 1.
Tip 6: Adding a Line Break in SSRS Expressions Developers use multiple text boxes to show multiline data otherwise a single TextBox can be used with just a line break. The VbCRLf (Visual Basic Carriage Return Line Feed) value can be used to add a line break in expressions.
I didn't have luck with the above answers. Here's what worked for me:
=IIF(Single.IsNAN(Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name")), 0, Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With