Calculation in a query

  • Thread starter Thread starter James V. Bohen
  • Start date Start date
J

James V. Bohen

I have a database with results from a phone survey. In a query, I
want to group the results by the answers given to a particular
question. Then I want to count the number of people who gave each
particular answer to that question. For this column I use
count(RespondentName). Finally I want to calculate the percentage of
people who said each answer. This last is the one I can't figure out.
It should be count(RespondentName) for each answer divided by
count(RespondentName) for the whole survey. How do I get the
denominator I want? Currently I'm manually entering the number of
responses for the whole survey as the denominator, i.e.,
count(RespondentName)/44.

Jim Bohen
 
Jim,

The easy "proper" way to do this (no code or other fancy stuff) is to create
a report based on your totals query, where it will be easy to do all your
subtotals / totals calculations.

A (quick and dirty, not as neat...) trick that may work (I haven't tried it,
but it should) is to create a second totals query on the same table, where
you count all respondents without any other grouping, so it just returns one
record with their total number. Then in a third (select query) use both
totals queries without any joins between them; take all fields of the
original and the total number from the second; this should get you the total
on all records.

HTH,

Nikos
 
Probably other ways to do this, but you could

1) create query that counts respondentname. This will
give you a count of all of them.

2) In your current query, pull query from above in. This
will allow you to do calculation, and have denominator
available.
 
Back
Top