目前我的 RS 图表中有 5 个柱 - 未来可能有 7 个柱或 17 个柱或 27 个柱!
有几个酒吧,我可以有这样的表达:
=iif(Fields!Market.Value = "Spain"
,"Gold"
,iif (Fields!Market.Value = "Denmark"
, "Gray"
, iif(Fields!Market.Value = "Italy"
, "Blue"
, "Purple"
)
)
)
如果我无法预测将包含多少个国家 + 我宁愿不必在“绿色”、“红色”等中硬编码,我该如何更改表达式?
我已经尝试过了,但它出错了:
=Switch(Mod(Fields!Rank.Value/CDbl(2))=CDbl(0), "Gold",
Mod(Fields!Rank.Value/CDbl(3))=CDbl(0), "Gray",
Mod(Fields!Rank.Value/CDbl(2))>CDbl(0) "Blue")
以上是完全不正确的语法:这有效:
=Switch(CDbl(Fields!Rank.Value Mod 2)=CDbl(0), "Gold",
CDbl(Fields!Rank.Value Mod 3)=CDbl(0), "Gray",
CDbl(Fields!Rank.Value Mod 2)>CDbl(0), "Blue")
好的 - 上面的运行(不知道如何!)但下面是基于 Dominic Goulet 的帮助,并且非常容易理解并且很好并且可以扩展为更多颜色;这是 5 种颜色的解决方案:
=Switch(CDbl(Fields!Rank.Value Mod 5)=CDbl(0), "Gold",
CDbl(Fields!Rank.Value Mod 5)=CDbl(1), "Gray",
CDbl(Fields!Rank.Value Mod 5)=CDbl(2), "Green",
CDbl(Fields!Rank.Value Mod 5)=CDbl(3), "Red",
CDbl(Fields!Rank.Value Mod 5)=CDbl(4), "Pink")