What is wrong with this expressions? =CountRows(ReportItems!Textbox58.Value = "Intervene"). I want to count each row which says Intervene

Solution 1:

As Larnu has commented, you cannot use CountRows against the ReportItems collection.

Probably what you need to do is

Look at the expression in Textbox58 and see where it gets it's data from. In this exmaple let's say it comes from Fields!myFieldName.Value.

Now we need to count the rows where Fields!myFieldName.Value = "Intervene" but rather than using count, we can convert these matches to return 1 or 0 where the field is not "Intervene"

So the expression would look something like this

=SUM(IIF(Fields!myFieldName.Value = "Intervene", 1, 0))

This will sum the rows withing the current scope, so if this is contained in a row group for example, then it will only sum those rows in that row group.

If you need to count based on a a different scope (e.g. the entire dataset) then you can specify that in the SUM() function like this

=SUM(IIF(Fields!myFieldName.Value = "Intervene", 1, 0), "DataSet1")

Here we are summing across the entire dataset where the dataset name is DataSet1


Update based on OP comment

As your expression is

=SUM(IIF(Fields!Actual_Duration.Value >= 10, "Intervene", "No Intervention Needed"))

What we actually need to count is instances where Actual_Duration is >= 10.

So the final expression should be

=SUM(IIF(Fields!Actual_Duration.Value >= 10, 1, 0))