Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count where value ="Yes" 1

Status
Not open for further replies.

JSMITH242B

Programmer
Mar 7, 2003
352
GB
Hi Group,
I have a field called "Disabled" in the underlying data source for my crystal report. The data holds yes or no values depending on whether the person is disabled or not.

I need to create a formula to count the number of disabled people i.e where the value is equal to yes. I have the following formula:
count ({VM6_csv.Disabled},{VM6_csv.Disabled}="Yes")
but I get the error message:The summary/running total could not be created.
What is the correct syntax to count the number of records where a value is equal to something you want to specify?
Any help much appreciated.

TIA
Jackie
 
The simplest means is to use a Running Total, and in the Evaluate->Use a formula place something like:

{table.yesnofield} = "Yes"

Or you can create a formula:

if {table.yesnofield} = "Yes" then
1
else
0

Place the field in the details, right click->insert summary->sum.

Now remove it from the details.

-k
 
You can just sum the field: sum({table.yesnofield}) for the count of yes's. Yes=1.

Lisa
 
You can also use the iif function to make it slightly simpler:

iif({table.yesnofield} = "Yes",1,0)

It work the same as the if statement above.

-Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top