How do I do a percentage

G

Guest

I want to display a percentage of attendance on a form, but I cannot think
how to generate the value.

I have a table tblMDTmemberattendance which has the fields

attendanceId Autonumber
TblMDTMemberID (Number) (PK)
TblMDTDateID (Number) (PK)
Attended (Number)

The attended field is 1 if Attended or 2 if not attended it is filled by a
combo attached to another table to give me flexibility instead of just yes/no.

How would I generate a percentage of attendance from this, I originally did
a query which counted the number of recoirds =1 and thought I would divide
this by total records for each attendee and multiply by 100, but cannot get a
total number of records count

any ideas

thanks

Phil
 
F

Franck

i guess you can do both request then.
first : total record for each attendee
second : total of records count

solution : UNION

select * from (qry_total_record_for_each_attendee)
UNION
select * from (qry_total_record_count)
after i guess your request return like 2 column that are column 1
attendee and column 2 count of those attendee like this

=========
| 1 | 1534 |
| 2 | 4656 |
=========
in your second query to count everything make sure it output 2 column
(if its like my example (2columns for first query))
and return like

=========
| C | 6190 |
=========

change the number for a letter or another value that will mean
somthing to you and you be able to distinguish from the attendee
counts

so with the UNION it should come out like this

=========
| 1 | 1534 |
| 2 | 4656 |
| C | 6190 |
=========

after that all you need is to return where you want your date or take
back the union query and try do a crosstable to switch first column as
header and second as value
crosstable should return like this

=================
| 1 | 2 | C |
| 1534 | 4656 | 6190 |
=================
 

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