简体   繁体   中英

Count expression SSRS Report

Trying to count all rows in a column where column=Yes I have two columns in my report Accepted and rejected.

I'm trying to count the rows where accepted=Yes and do the say thing for rejected.

I've tried these:

=COUNT(IIF(Fields!accepted.Value="Y",1,0))
=COUNT(IIF(Fields!rejected.Value="Y",1,0))   
=COUNT(FIELDS!accepted.value="Y")
=COUNT(FIELDS!rejected.value="Y")

this expression is counting every row as opposed to just the ones that are "Y"

You can do this a couple of ways:

SUM(IIF(Fields!accepted.Value="Y",1,0))

or

COUNT(IIF(Fields!accepted.Value="Y",1,Nothing))

COUNT is a count of all Rows, so even by returning 0 it will get included in the count. This is why returning Nothing should do the trick.

=SUM(IIf(Fields!Doc_Type.Value = "Shipments", 1, 0), "YourDataSetName")

this worked for me with no errors. saw this on another post.

您可以尝试使用“And”运算符来检查两个条件。

=COUNT(IIF(Fields!accepted.Value ="Y" And Fields!rejected.value="Y",1,0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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