2017-06-22 88 views
0

Here is my output Here is what My Table looks like 我的代碼應該總和,但它給我不正確的結果。與IIF條件SSRS琛表達

=SUM(IIF(Fields!BusinessDriver.Value = "Business Risk Reduction", 
Fields!BRRCalcRRPVETC.Value, IIF(Fields!BusinessDriver.Value = "Major 
Growth" OR Fields!BusinessDriver.Value = "Contractual Growth" OR 
Fields!BusinessDriver.Value = "Growth Improvement" OR 
Fields!BusinessDriver.Value = "Sustenance Efficiency", 
Fields!NPVonETC.Value, NOTHING))). 

有什麼我做錯了嗎? 此代碼發送到我的總計字段中。

+0

請提供您的報告的樣本,顯示當前輸出與預期輸出 – niktrs

+0

嗨,我已經連接2個樣品。一個是我的表,另一個是已導出爲ex​​cel的結果集。有成千上萬的行,但我刪除它們,以獲得屏幕抓取。基本上,當我總計第二列,(我仔細檢查這個在Excel中,以確保它總結),但它不總和與@niktrs下面的總行相同 –

回答

0

嘗試使用switch()代替。

=sum(switch(Fields!BusinessDriver.Value = "Business Risk Reduction", Fields!BRRCalcRRPVETC.Value, Fields!BusinessDriver.Value = "Major Growth", Fields!NPVonETC.Value, Fields!BusinessDriver.Value = "Contractual Growth", Fields!NPVonETC.Value, Fields!BusinessDriver.Value = "Growth Improvement", Fields!NPVonETC.Value, Fields!BusinessDriver.Value = "Sustenance Efficiency", Fields!NPVonETC.Value, 1=1, 0)) 

欲瞭解更多信息,請參見這裏:https://docs.microsoft.com/en-us/sql/reporting-services/report-design/expression-examples-report-builder-and-ssrs