本文共 1520 字,大约阅读时间需要 5 分钟。
I'm creating an SSRS report and have three Date fields.
StartDate TargetDate CompleteDate
In my report I want to create a calculated field with a few conditions to determine if the Target Dates have been met.
If CompleteDate <= TargetDate then "Yes", "No"
If CompleteDate is NULL but TargetDate has not exceeded current date then "Pending","No" (ie, startdate was 01/01/2019 and targetdate is 20/03/2019)
Edit 1*
IIF(Fields!CompleteDate.Value <= Fields!TargetDate.Value, "Yes", IIF(Fields!CompleteDate.Value Is Nothing AND Fields!TargetDate.Value < Now(), "Pending", "No")
This returns "No" or "Pending" even if the TargetDate has been met.
Edit 2*
IIF((Format(Fields!CompleteDate.Value,"dd-MM-yyyy") <= (Format(Fields!TargetDate.Value,"dd-MM-yyyy"), "Yes", IIF(Fields!CompleteDate.Value Is Nothing AND Fields!TargetDate.Value < Now(), "Pending,"No")
Error in regards to "Overload resolution failed because no accessible 'IIF' accepts this number of arguments." Is there a bracket misplacement?
Edit 3* @Sentinel - The Switch expression worked perfect
=Switch( NOT isNothing(Fields!CompleteDate.Value) AND Fields!CompleteDate.Value <= Fields!TargetDate.Value, "Completed On-Time" , NOT isNothing(Fields!CompleteDate.Value) AND Fields!CompleteDate.Value > Fields!TargetDate.Value, "Completed Late" , isNothing(Fields!StartDate.Value), "Not Started" , Fields!TargetDate.Value > Now(), "In Progress" , Fields!TargetDate.Value <= Now(), "Running Late" , TRUE, "Other")
Thanks @Sentinel, @Steve-o169 I very much appreciate it
转载地址:https://blog.csdn.net/weixin_32820131/article/details/114558480 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!