At first, you need to be sure that the fields you are using to calculate your value are really numbers.
Normally, you get NaN
when trying to divide 0 / 0 or Infinity
when you are dividing any number by 0.
So, a generic resolution for NaN
, Infinity
or even #Error
(that happens when a null value is passed to a division) is to create a Function that will work on this values for you.
Right click on the background of your report and go to Report Properties as shown:

Then you can go on tab Code
and add your custom code:
Public Function Divide(ByVal dividend As Double, ByVal divisor As Double) As Double
If IsNothing(divisor) Or divisor = 0 Or IsNothing(dividend) Or dividend = 0 Then
Return 0
Else
Return dividend / divisor
End If
End Function
We use IsNothing()
to avoid #Error
and check whether the divisor or the dividend are 0 to avoid NaN
and Infinity
.
And then you replace your expression with:
= Code.Divide(Sum(Fields!A.Value), Sum(Fields!B.Value))
To make this looks like a percentage, I strongly recommend you change your Textbox
properties. So, right click on it, go on Textbox Properties and over tab Number. Select category Percentage.
By doing this, you make sure that de SSRS will consider this value as percentage and not a text even when it is exported to other platforms such as Excel.
You can also check the Microsoft documentation on adding code to a Report (SSRS)