[英]Use Countif in ssrs expression
I want the below result in ssrs expression. 我想要以下结果在ssrs表达式中。 In excel I have used countif function to resolved this but i didn't get similar function in ssrs.
在excel中,我使用过countif函数来解决此问题,但在ssrs中却没有得到类似的功能。
Excel formula: Excel公式:
=IF(COUNTIF(H1:K1,"C")>0,"C",IF(COUNTIF(H1:K1,"B")>0,"B","A"))
Result: 结果:
H I J K Final
A B A A B
A A A A A
A B A A B
A C A A C
I have used above formula in Final column. 我在“最终”栏中使用了上述公式。 I want same output in ssrs expression.
我想要ssrs表达式中的相同输出。
Ass u me ing that your field names are H, I, J, K, your expression would look like this: 屁股 ü 我荷兰国际集团,你的字段名是H,I,J,K,你的表情应该是这样的:
=IIF(Fields.H.Value = "C" OR Fields.I.Value = "C" OR Fields.J.Value = "C" OR Fields.K.Value = "C", "C",
IIF(Fields.H.Value = "B" OR Fields.I.Value = "B" OR Fields.J.Value = "B" OR Fields.K.Value = "B", "B", "A"))
This read as IF H, I, J, or K are C then C else if H, I, J, or K are B then B else A. 如果H,I,J或K为C,则为C,否则为C;如果H,I,J或K为B,则为B,否则为A。
If you were summing rows instead of columns, you would make something a little closer to the CountIF function: 如果要对行而不是列求和,则会使CountIF函数更接近一点:
=IIF(SUM(IIF(Fields!H.Value = "C", 1, 0)) > 0, "C", ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.