简体   繁体   English

DATEDIFF返回负值-SSRS

[英]DATEDIFF returns Negative Values -SSRS

This is my expression. 这是我的表情。

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

It returns both positive and negative numbers. 它返回正数和负数。 Sometimes when a user does not enter an 'actualendValue', it returns a negative number like '-1234'. 有时,当用户不输入“ actualendValue”时,它会返回一个负数,例如“ -1234”。

What i'm trying to do with this equation (below) is , if a negative value is returned, display a '0'. 我正在尝试使用此方程式(以下)进行操作,如果返回负值,则显示“ 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))

Can anyone help me , with my second equation or is there a better way to do this?,I'm just about to pull my hair out. 有人可以帮我解决第二个问题吗,或者有更好的方法做到这一点?,我正要拔头发。

Many Thanks. 非常感谢。

UPDATE 1: I have tried : 更新1:我已经尝试过:

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

When I run this expression I get not errors, and I still get positive and negative values. 当我运行此表达式时,不会出现错误,并且仍会得到正值和负值。

解:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM