2016-11-23 61 views
0

我有一個SSRS報告,其中兩個日期都有NULL值,因此它返回錯誤。所有其他日期都返回正確的值。如何通過錯誤返回空白單元格?我究竟做錯了什麼?我想計算兩個日期之間的天數差異,不包括週末,在某些情況下兩個日期都爲NULL

代碼,我下面嘗試:

=IIF(IsNothing(Fields!BondRegCSTM_DateRegistered.Value) AND IsNothing(Fields!CommRecHistory_DateReceived.Value), Nothing, 

(DateDiff("d", Fields!BondRegCSTM_DateRegistered.Value, Fields!CommRecHistory_DateReceived.Value))+1- 
(DateDiff("ww", Fields!BondRegCSTM_DateRegistered.Value, Fields!CommRecHistory_DateReceived.Value)*2)- 
(IIF(DatePart("w", Fields!CommRecHistory_DateReceived.Value) = 1, "1", "0"))- 
(IIF(DatePart("w", Fields!BondRegCSTM_DateRegistered.Value) = 1, "1", "0"))) 
+0

應該和和是或? – user1429080

回答

0

也許你可以使用COALESCE函數返回非空的值。

0

感謝您的協助,但我設法讓它排序。這是我用過的,它完美的工作。我看到很多開發者都有這個問題。所以,我希望這將幫助更多的開發者面臨這樣的問題:)

CODE:

= IIF(場BondRegCSTM_DateRegistered.Value什麼或字段CommRecHistory_DateReceived.Value是什麼, 「」,

(DateDiff(DateInterval.day,Iif(IsNothing(Fields!BondRegCSTM_DateRegistered.Value),Fields!BondSales_GrantedDate.Value, Fields!BondRegCSTM_DateRegistered.Value),Iif(IsNothing(Fields!CommRecHistory_DateReceived.Value),Fields!BondSales_GrantedDate.Value, Fields!CommRecHistory_DateReceived.Value))+ 1) - (DateDiff(DateInterval.WeekOfYear,Iif(IsNothing(Fields!BondRegCSTM_DateRegistered.Value),Fields!BondSales_GrantedDate.Value, Fields!BondRegCSTM_DateRegistered.Value),Iif(IsNothing(Fields!CommRecHistory_DateReceived.Value),Fields!BondSales_GrantedDate.Value (Weekday(Fields!BondRegCSTM_DateRegistered.Value,1)= 1,1,0) -IIF(Weekday(Fields!BondRegCSTM_DateRegistered.Value,1)= 7, (平日(Fields!CommRecHistory_DateReceived.Value,1)= 7,1,0)-1)

-IIF(平日(Fields!CommRecHistory_DateReceived.Value,1)= 1,1,0)
相關問題