简体   繁体   English

SSRS表达计数

[英]SSRS expression count

I can use expression =count(Fields!xxx.value, "DataSet1") and return the total count. 我可以使用表达式=count(Fields!xxx.value, "DataSet1")并返回总数。

But I have a field with Active and Not active and want to count for record with active. 但是我有一个处于活动状态且未处于活动状态的字段,并且希望计数活动状态下的记录。 I use expression =Count(IIf(Fields!xxx.Value = "Active", 1, Nothing)) and it will not work. 我使用表达式=Count(IIf(Fields!xxx.Value = "Active", 1, Nothing)) ,它将无法正常工作。

It said "the value expression for textbox uses an aggregate expression without scope. a scope is requiered for all aggregates use outside od a data region unless the export contains exactly one datadset" 它说:“文本框的值表达式使用不带范围的聚合表达式。除非在导出中仅包含一个数据集,否则在数据区域之外使用的所有聚合都需要一个范围”

You have two problems. 你有两个问题。

1: you need to include the "DataSet1" scope in your field definition, like you did in the count which worked. 1:您需要在字段定义中包括“ DataSet1”范围,就像在有效计数中所做的一样。

2: instead of doing a count on your IIF statement, do a SUM of IIF([Condition Is True],1,0) 2:不对IIF语句进行计数,而是对IIF求和([Condition Is True],1,0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM