SSRS 2008 - Dealing with division by zero scenarios

后端 未结 4 1797
北海茫月
北海茫月 2020-11-30 07:16

We\'re running into a problem with one of our reports. In one of our tablixes a textbox has the following expression:

=Iif(Fields!SomeField.Value = 0, 0, Fie         


        
4条回答
  •  暖寄归人
    2020-11-30 08:05

    On reflection, I feel best idea is to multiply by value to power -1, which is a divide:

    =IIf
      (
          Fields!SomeField.Value = 0
        , 0
        , Fields!SomeOtherField.Value * Fields!SomeField.Value ^ -1
      )
    

    This doesn't fire pre-render checks as val * 0 ^ -1 results in Infinity, not error

提交回复
热议问题