views:

40

answers:

1

I'm trying to create a rdlc report in Visual Studio 2008 and I'm having a bit of trouble with the totals at the end.

I have a string field called "Reward" that displays either 1, 2, 3 or B. At the end of the report, I need to count up how many total records, how many "B"s and how many are not "B"s. So my inclination is to have three fields at the bottom as such:

Total      =COUNT(IIF(Fields!Reward.Value > "a",1,0))
Bs         =COUNT(IIF(Fields!Reward.Value = "B",1,0))
Non-Bs     =COUNT(IIF(Fields!Reward.Value <> "B",1,0))

But all three end up equaling the same (the total record count). I thought that seemed weird so I tried data that doesn't appear in that column at all such as

=COUNT(IIF(Fields!Reward.Value = "4",1,0))

and I still get the same number. Any ideas what I'm doing wrong?

+1  A: 

Perhaps you want SUM instead of COUNT?

If you're returning value 0 or 1 from your IIF, you're actually just counting how many values are being returned, no matter the numeric value within.

Change the Bs and Non-Bs to SUM, and you'll get the results you're looking for.

p.campbell
Huh, I don't know why this works vs COUNT but it does! Thanks a lot for your help P.
invisiblestupid