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"
Using IIF Function in SSRS We are going to add a new field to the report data set to determine if the Order Year is the Max or Current Year. As shown below, the dataset properties window is opened, and the Fields tab is selected. After clicking Add, at the bottom of the list a new field is added.
To add an expression to a text box For a simple expression, type the display text for the expression in the text box. For example, for the dataset field Sales, type [Sales] . For a complex expression, right-click the text box, and select Expression. The Expression dialog box opens.
Let me show you how I add the total number of rows in a SSRS table. I start by going to the Design layout tab. Next, select the table as shown in the above image. As I mentioned earlier, I want the text box to appear above the table in the left-hand corner.
To add totals for a row group In the tablix data region row group area, right-click a cell in the row group area for which you want totals, point to Add Total, and then click Before or After.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With