Reporting Services - Count Column Values if equals A

后端 未结 2 1119
有刺的猬
有刺的猬 2021-01-02 04:49

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

2条回答
  •  情书的邮戳
    2021-01-02 05:05

    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.

提交回复
热议问题