Hi,
In the denominator "CountDistinct(iif(Fields!IsEncounter.Value = 1, Fields!PatientVisitId2.Value,Nothing))"
In this expression, if the Fields!IsEncounter.Value≠1, it will be CountDistinct(nothing)=0, zero cannot be used as a divisor. So there will be "Infinity" and "Nan".
I assumed that you're trying to do calculations on the entire data.
So you should use the expression on a single textbox instead of a column.
If I misunderstand, please check the needs you want and then we can improve it.
If you have any question, please feel free to let me know.
If your problem has been solved, please mark "accepted answer" on my reply, thank you for your understanding.
Regards,
Zoe