Counting specific records

P

PowellGirlTN

I have a report that lists employees and their job function. At the bottom
of the report I want to list each job function and count how many people do
that function. This is not working for me, any idea what I'm doing wrong.
Thank you

=Count([JobFunctionID])="Typist"
 
D

Duane Hookom

Count() counts everything that isn't null. The expression
([JobFunctionID])="Typist"
will evaluate to either -1/True or 0/False. Count() will count all the -1
and 0 values.

You can use:
=Sum(Abs([JobFunctionID]="Typist"))
If you have multiple JobFunctions, then you might want to use a subreport
that has a Record Source that Groups By JobFunctionID and Counts
JobFunctionID.
 
P

PowellGirlTN

Thanks so much for your explanation, may I ask though what does ABS indicate?
Thanks again.

Duane Hookom said:
Count() counts everything that isn't null. The expression
([JobFunctionID])="Typist"
will evaluate to either -1/True or 0/False. Count() will count all the -1
and 0 values.

You can use:
=Sum(Abs([JobFunctionID]="Typist"))
If you have multiple JobFunctions, then you might want to use a subreport
that has a Record Source that Groups By JobFunctionID and Counts
JobFunctionID.


--
Duane Hookom
Microsoft Access MVP


PowellGirlTN said:
I have a report that lists employees and their job function. At the bottom
of the report I want to list each job function and count how many people do
that function. This is not working for me, any idea what I'm doing wrong.
Thank you

=Count([JobFunctionID])="Typist"
 
D

Duane Hookom

Abs() returns the absolute value of the expression.
[JobFunctionID]="Typist" will evaluate to -1 or 0
Abs([JobFunctionID]="Typist") changes -1 to +1
Sum(Abs([JobFunctionID]="Typist")) sums the absolute value
--
Duane Hookom
Microsoft Access MVP


PowellGirlTN said:
Thanks so much for your explanation, may I ask though what does ABS indicate?
Thanks again.

Duane Hookom said:
Count() counts everything that isn't null. The expression
([JobFunctionID])="Typist"
will evaluate to either -1/True or 0/False. Count() will count all the -1
and 0 values.

You can use:
=Sum(Abs([JobFunctionID]="Typist"))
If you have multiple JobFunctions, then you might want to use a subreport
that has a Record Source that Groups By JobFunctionID and Counts
JobFunctionID.


--
Duane Hookom
Microsoft Access MVP


PowellGirlTN said:
I have a report that lists employees and their job function. At the bottom
of the report I want to list each job function and count how many people do
that function. This is not working for me, any idea what I'm doing wrong.
Thank you

=Count([JobFunctionID])="Typist"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top