【问题标题】:DATEDIFF returns Negative Values -SSRSDATEDIFF 返回负值 -SSRS
【发布时间】:2015-06-02 14:50:05
【问题描述】:

这是我的表情。

=DateDiff(DateInterval.Day,Fields!scheduledstartValue.Value,Fields!actualendValue.Value )

它返回正数和负数。有时,当用户没有输入“actualendValue”时,它会返回一个负数,例如“-1234”。

我试图用这个等式(如下)做的是,如果返回负值,则显示“0”。

IIf([Fields!scheduledstartValue.Value]="","",IIf(Nz(DateDiff('d',[Fields!scheduledstartValue.Value],[Fields!actualendValue.Value]),0)>0,Nz(DateDiff('d',[Fields!scheduledstartValue.Value],[Fields!actualendValue.Value]),0),0))

谁能帮助我,用我的第二个等式还是有更好的方法来做到这一点?,我正要拔头发。

非常感谢。

更新 1: 我试过了:

=IIF(DateDiff(DateInterval.Day,Fields!scheduledstartValue.Value,Fields!actualendValue.Value ) = 0,"NA",DateDiff(DateInterval.Day,Fields!scheduledstartValue.Value,Fields!actualendValue.Value ))

当我运行这个表达式时,我没有得到错误,我仍然得到正值和负值。

【问题讨论】:

    标签: reporting-services reportbuilder3.0 ssrs-expression


    【解决方案1】:

    解决方案:

     =IIF(Fields!actualendValue.Value is nothing, nothing, DateDiff(DateInterval.Day,Fields!scheduledstartValue.Value,Fields!actualendValue.Value ))
    

    【讨论】:

      猜你喜欢
      • 2010-09-20
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多