|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 7:12 AM
Points: 36,
Visits: 109
|
|
I want to use count function on the field 'Status' - counting the records only if the value in the field is "C". I'm trying the following ways, but it just returns count of all the rows in status field.
=Count(Fields!Status.Value = "C") OR =IIF(Fields!Status.Value = "C", Count(Fields!Status.Value), 0)
could you please suggest?
thanks
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 12, 2012 7:47 AM
Points: 138,
Visits: 696
|
|
Try =COUNT(IIF(Fields!Status.Value = "C", Fields!Status.Value, Nothing))
toolman Numbers 6:24-26
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 10:13 AM
Points: 20,
Visits: 397
|
|
singhs2 (6/25/2008) I want to use count function on the field 'Status' - counting the records only if the value in the field is "C". I'm trying the following ways, but it just returns count of all the rows in status field.
=Count(Fields!Status.Value = "C") OR =IIF(Fields!Status.Value = "C", Count(Fields!Status.Value), 0)
could you please suggest?
thanks
Try this:
=Count(IIF(Field!Status.Value="C", 1, 0))
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 7:12 AM
Points: 36,
Visits: 109
|
|
=COUNT(IIF(Fields!Status.Value = "C", Fields!Status.Value, Nothing))
worked for me, thanks
Now I have another addition to this. How about if I need the two conditions- Fields!Status.Value = "C" AND Fields!Race.Value = "W"
this statement is not working now! could you please suggest
thanks a lot for all your help!
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 12, 2012 7:47 AM
Points: 138,
Visits: 696
|
|
Change your AND to OR. That should do it.
toolman Numbers 6:24-26
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 7:12 AM
Points: 36,
Visits: 109
|
|
In other words, how would I write this count in the footer of reporting services-
select Count(*) From tableA Where status = 'C' and race = 'B'
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 16, 2013 7:12 AM
Points: 36,
Visits: 109
|
|
It did work! I think I didn't refresh the first time!
=COUNT(IIF(Fields!Status.Value = "C" And Fields!Race.Value = "W", Fields!Status.Value, Nothing))
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 12, 2012 7:47 AM
Points: 138,
Visits: 696
|
|
Sorry. Didn't notice at first that you had different fields. Try
=SUM(IIF(Fields!Status.Value = "C" AND Fields!Race = "W", 1, 0))
I think that should work for you.
Here's a couple good resources for expression writing: http://msdn2.microsoft.com/en-us/library/ms157328.aspx http://msdn2.microsoft.com/en-us/library/c157t28f(vs.71).aspx
toolman Numbers 6:24-26
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, March 11, 2013 10:18 AM
Points: 73,
Visits: 238
|
|
=Count(IIf(Fields!sutastat.Value = "LA",1,0)) I only have 4 records with that status. This still returns all rows.
When I try this: =Count(IIf(Fields!sutastat.Value = "LA", Fields!sutastat.Value,Nothing))
I get zero
All i'm trying to do is this select count(*) from employeecount where sutastat = 'la'
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, March 12, 2012 7:47 AM
Points: 138,
Visits: 696
|
|
Try using SUM instead of COUNT. SUM(IIF(your field Value = "LA",1,0)) This way it's summing ones or zeros instead of conditionally counting fields.
toolman Numbers 6:24-26
|
|
|
|