简体   繁体   中英

SSRS expression count

I can use expression =count(Fields!xxx.value, "DataSet1") and return the total count.

But I have a field with Active and Not active and want to count for record with active. I use expression =Count(IIf(Fields!xxx.Value = "Active", 1, Nothing)) and it will not work.

It said "the value expression for textbox uses an aggregate expression without scope. a scope is requiered for all aggregates use outside od a data region unless the export contains exactly one datadset"

You have two problems.

1: you need to include the "DataSet1" scope in your field definition, like you did in the count which worked.

2: instead of doing a count on your IIF statement, do a SUM of IIF([Condition Is True],1,0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM