One way, if there is a discrete list of options that isn't going to change:
=SUM(IIF(Fields!shloc.Value="Test", 1,0))
Otherwise, you'll want to do something like a PIVOT in the SQL query in your dataset, or possibly custom VB.
Question
I have a query which has a column, schloc
schloc
TEST
TEST
TEST
TEST
NOTEST
NOTEST
NOTEST
NOTEST
RANDOM
RANDOM
RANDOM
RANDOM
I want to put it in a table in my SSRS report like this:
TEST NOTEST RANDOM
4 4 4
How can I use the COUNT for my expression to get the count?
I tried to add this: =SUM(IIF(IsNothing(Fields!Completed.Value),0,1))
but it didn't yield anything in the report.
Solution
One way, if there is a discrete list of options that isn't going to change:
=SUM(IIF(Fields!shloc.Value="Test", 1,0))
Otherwise, you'll want to do something like a PIVOT in the SQL query in your dataset, or possibly custom VB.
OTHER TIPS
Here you need to use GroupBy to get the count :
SELECT COUNT(*) FROM yourTable GROUP BY schloc