DATEDIFF(D, dbo.Sum_ProductionPersonnel.LastLeaverDate, dbo.Sum_ProductionPersonnel.HRMSStartDate) AS DaysBetweenLastLeaverAndStartDate
这是我想在SSRS中使用的查询中的计算。
在我的SSRS表中,我希望公式显示
IF DaysBetweenLastLeaverAndStartDate < 0 Show N/A
Else Show days
有什么想法吗?
答案 0 :(得分:0)
在CASE
语句的两个部分中使用整个函数:
CASE WHEN DATEDIFF(D, dbo.Sum_ProductionPersonnel.LastLeaverDate, dbo.Sum_ProductionPersonnel.HRMSStartDate) < 0
THEN 'N/A'
ELSE DATEDIFF(D, dbo.Sum_ProductionPersonnel.LastLeaverDate, dbo.Sum_ProductionPersonnel.HRMSStartDate)
END as DaysBetweenLastLeaverAndStartDate
答案 1 :(得分:0)
您可以使用 IIF 语句在文本框表达式中类似地执行此操作:
=IIF(DATEDIFF("d", Fields!LastLeaverDate.Value, Fields!HRMSStartDate.Value) < 0, "N/A", DATEDIFF("d", Fields!LastLeaverDate.Value, Fields!HRMSStartDate.Value))