SSRS表达式问题,问题是)或,

时间:2018-12-14 21:41:02

标签: sql sql-server reporting-services

我的SQL语句:

=IIF
(
  IIF(
   SUM(Fields!EstUnits.Value) <= 0,
   0,
   Sum(Fields!JTDUnits.Value) / 
   IIF
   (
     Sum(Fields!EstUnits.Value)=0,
     1, 
     Sum(Fields!EstUnits.Value)
   )
  )<=0,
  Sum(Fields!PeriodCost.Value) + Sum(Fields!EstCost.Value),
  IIF
  (
    IIF
    (
      SUM(Fields!EstUnits.Value) <= 0,
      0,
      Sum(Fields!JTDUnits.Value) / 
      IIF
      (
        Sum(Fields!EstUnits.Value)=0,1,Sum(Fields!EstUnits.Value)
      )
    )>0.25,
    Sum(Fields!JTDCost.Value)/ Sum(Fields!EstCost.Value),
    Sum(Fields!EstCost.Value)
  )
)

获取错误消息:

Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object, FalsePart As Object) As Object'.

我知道它的a)或,但是我已经尝试了好几个小时了,我希望对此有更多的关注。 该语句应该评估%是否<=零,然后将两列加在一起;否则,如果%大于25%,则将列除以%,否则= column

1 个答案:

答案 0 :(得分:0)

当我分解表达式时会涉及到此问题(我总是用4替换值,而用b替换条件):

=IIF(4)<=0,4,4)

您必须检查一下自己,因为我真的不知道如何根据您的结果更正此表达式:

=IIF(
  IIF(
      b,
      0,
      4 / IIF(b,1, 4)
      ) <=0,
          4,
  IIF(
   IIF(
       b,
       0,
       4 / IIF(b,1,4)
       ) >0.25,
             4,
             4
     )
    )