具有IIF条件的SSRS和表达式

时间:2017-06-22 05:02:47

标签: reporting-services sum ssrs-2012

Here is my output Here is what My Table looks like 我的代码应该总计总和,但它给我的结果不正确。

=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))). 

我做错了什么吗? 此代码在我的总计字段中。

1 个答案:

答案 0 :(得分: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