简体   繁体   English

SSRS 表达式过滤然后计数

[英]SSRS Expression to Filter and then Count

I have a large query that each record has a unique WO Number and a division.我有一个大查询,每条记录都有一个唯一的 WO 编号和一个部门。 I would like to use an expression in the text box to give me a number of unique work orders with a specific division.我想在文本框中使用一个表达式来给我一些具有特定部门的独特工单。

Example:例子:

Dataset name: CorrectiveWOsOPEN

WO_NUMBER  DIVISION
20-005802  Maintenance
20-005803  Maintenance
20-014771  Maintenance
20-027196  PCA
20-027197  Water
20-027198  Water
18-005079  Water
18-005541  Water

Desired Result for filter for 'Water" division and count the number of records: “水”除法过滤器的所需结果并计算记录数:

4

I got the count expression but not know how to attach on the filter for "Water" in division column.我得到了计数表达式,但不知道如何在除法列中附加“水”的过滤器。

=Count(Fields!WO_NUMBER.Value, "CorrectiveWOsOPEN")

Any ideas?有任何想法吗?

Put an IIF inside a sum to count the ones with your desired filter.将 IIF 放入总和中以计算具有所需过滤器的那些。

=SUM(IIF(Fields!DIVISION.Value = "Water", 1, 0), "CorrectiveWOsOPEN")

This will check each record for a Division of Water and return 1 if it is and zero if not and then sums these up.这将检查每个记录的水分部,如果是则返回 1,如果不是则返回零,然后将它们相加。

I suppose you could also do the same with COUNT and NOTHING but I think the former method is more elegant (for lack of a better word).我想你也可以对 COUNT 和 NOTHING 做同样的事情,但我认为前一种方法更优雅(因为没有更好的词)。

=COUNT(IIF(Fields!DIVISION.Value = "Water", Fields!WO_NUMBER.Value, NOTHING), "CorrectiveWOsOPEN")

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

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