我想根据用户选择的参数更改列的背景填充颜色,并且过滤器产生的值为红色,绿色或黄色。
如果Parameter1 =“A”且Parameter2 =“B”,则根据要求填写结果(如下)。如果Parameter1 =“C”且Parameter2 =“D”,则根据其他要求填充数字。如果Parameter1和Parameter2是任何其他值(E,F,G),则将背景保留为“白色”。
到目前为止我尝试了什么:
=Switch(Parameters!Site.Value="A" AND Parameters!Place.Value = "B", IIF(Fields!Cost.Value < 100, "Green", IIF(Fields!Cost.Value >= 101 AND Fields!Cost.Value <= 200, "Yellow", IIF(Fields!Cost.Value > 300, "Red", "White"))), "White")
OR
(Parameters!Site.Value="C" AND Parameters!Place.Value = "D", IIF(Fields!Cost.Value < 300, "Green", IIF(Fields!Cost.Value >= 301 AND Fields!Cost.Value <= 400, "Yellow", IIF(Fields!Cost.Value > 400, "Red", "White"))), "White"), True, "White")
答案 0 :(得分:0)
也许您需要使用OR而不是AND:
=Switch((Parameters!Site.Value="A" OR Parameters!Place.Value = "B") AND Fields!Cost.Value < 100, "Green",
(Parameters!Site.Value="A" OR Parameters!Place.Value = "B") AND Fields!Cost.Value >= 101 AND Fields!Cost.Value <= 200, "Yellow",
(Parameters!Site.Value="A" OR Parameters!Place.Value = "B") AND Fields!Cost.Value > 300, "Red", "White")
答案 1 :(得分:0)
尝试以下表达式:
=Switch(
Parameters!Site.Value="A" AND Parameters!Place.Value = "B" AND Fields!Cost.Value < 100, "Green",
Parameters!Site.Value="A" AND Parameters!Place.Value = "B" AND Fields!Cost.Value <= 200, "Yellow",
Parameters!Site.Value="A" AND Parameters!Place.Value = "B" AND Fields!Cost.Value > 300, "Red",
Parameters!Site.Value="C" AND Parameters!Place.Value = "D" AND Fields!Cost.Value < 300, "Green",
Parameters!Site.Value="C" AND Parameters!Place.Value = "D" AND Fields!Cost.Value >= 301 AND Fields!Cost.Value <= 400, "Yellow",
Parameters!Site.Value="C" AND Parameters!Place.Value = "D" AND Fields!Cost.Value > 400, "Red",
True, "White"
)