Reporting Services - Count Column Values if equals A

后端 未结 2 1054
有刺的猬
有刺的猬 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.

    0 讨论(0)
  • 2021-01-02 05:22

    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?

    0 讨论(0)
提交回复
热议问题