all groups > sql server reporting services > october 2005 >
You're in the

sql server reporting services

group:

Formula Question



Formula Question Wayne Wengert
10/30/2005 3:53:35 AM
sql server reporting services: I have a field "Accept" that can be Null or contain either "Y" or "N". In my
test data I have a total of 4 rows, 2 with "Y", 1 with "N" and 1 Null. I
want a count of each case in the footer along with some descriptive text. I
tried the formula
=Count(Fields!Accept.Value="Y")

But it returns "4"? The same thing happens if I use

=Count(Fields!Accept.Value="N")

What is wrong in this formula?

Also, I really want the report to display something like: "Number of
Accepts: 2" but if I try to code the field as:

"Number of Accepts: " & =Count(Fields!Accept.Value="Y")

the formula displays as text?



TIA

Wayne



Re: Formula Question Robert Bruckner [MSFT]
10/30/2005 3:28:43 PM
The Count RDL aggregate function works similar as the Count aggregate in
SQL: it will count all rows that are NOT NULL. The expresson
Fields!Accept.Value="Y" will return a boolean value (true/false) for all
rows, that's why the count results in the value 4.

Besides using =Sum(iif(...)) as shown by Liz, you could also use
=Count(iif(Fields!Accept.Value="Y", 1, Nothing))

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

Re: Formula Question Wayne Wengert
10/30/2005 4:12:11 PM
Liz;

Thank you very much. I never would have figured that one out. Seems like
making a point the hard way. I've ordered a couple of books that I hope will
explain the logic of creating expressions.

Wayne

[quoted text, click to view]

Re: Formula Question Wayne Wengert
10/30/2005 6:57:23 PM
Robert;

Thanks for that additional information. It helps me understand the process.

Wayne

[quoted text, click to view]

Re: Formula Question Liz Matyas
10/30/2005 10:34:59 PM
try to write:

= "Number of Accepts: " & Sum(IIf(Fields!Accept.Value="Y",1,0))

Good Luck


[quoted text, click to view]

AddThis Social Bookmark Button