I have a dataset called \'dsAllStuTargetData\' - i\'m trying to count the number of the \'A\' values that appear in the column \'Target\'.
I\'m doing this using a te
For this case you need a Sum
, not a Count
, i.e. something like:
=Sum(IIf(Fields!Target.Value = "A", 1, 0), "dsAllStuTargetData")
Count
will just count the number of rows; the IIf
doesn't do anything there - something like CountDistinct
can be affected in certain cases but this will not work here.
However, Sum
will take the total of all rows which meet the IIf
condition, i.e. the total of all 1
values in the DataSet, which is what you're after.
IIF wants it's arguments in the format:
IIF(condition, true part, false part)
Which would equate to something like
Count(IIF(Fields!Target.Value = "A",1,0),"dsAllStuTargetData")
Does that work?