SSRS IIF和切换功能

时间:2020-10-23 19:46:30

标签: reporting-services ssrs-2012 ssrs-tablix

我有一个要在其中基于Continent列值更改列(销售)背景颜色的报告。以下是大洲列值。
enter image description here

我在“销售”列(背景色)下尝试了以下表达式,

=IIF(Fields!column.Value ="4th Quarter",
 SWITCH (
                   Fields!continents.Value ="Asia", "Green",
                   Fields!continents.Value = "N America","LIMEGREEN",
                   Fields!continents.Value ="S America","Yellow",
                   Fields!continents.Value = "Europe", "Red"  
         )
, "Dummy Value")  

预览报告时,所有行只能看到绿色。我知道SSRS中的Switch函数将返回它找到的第一个表达式。
我也尝试只使用IIF条件,仍然是同样的问题。有没有办法可以实现?

1 个答案:

答案 0 :(得分:0)

您是否尝试过以下方法?

=IIF((Fields!column.Value ="4th Quarter") AND (Fields!continents.Value ="Asia"),"Green",
     IIF((Fields!column.Value ="4th Quarter") AND (Fields!continents.Value = "N America"),"LIMEGREEN",
        IIF((Fields!column.Value ="4th Quarter") AND (Fields!continents.Value ="S America"),"Yellow",
            IIF((Fields!column.Value ="4th Quarter") AND (Fields!continents.Value = "Europe"), "Red",
            "Dummy Value"))))