问题
I need to incorporate and iif statment in my expression. What I want to do is say if a field value = 0 then Fields!example1.value/Fields!example2.value else Fields!example1.value/Fields!example3.value. I hope that is clear in what I am trying to accomplish.
回答1:
You have to validate twice in order to keep your report safe of division by zero erros.
Try this:
=iif(
Fields!Field2.Value=0,
iif(Fields!Field3.Value=0
,0
,Fields!Field1.Value/iif(Fields!Field3.Value=0,1,Fields!Field3.Value)),
Fields!Field1.Value/iif(Fields!Field2.Value=0,1,Fields!Field2.Value)
)
来源:https://stackoverflow.com/questions/33264428/ssrs-using-iff-when-dividing