Count and Percentage

vrk1

Registered User.
Local time
Today, 01:02
Joined
Nov 18, 2004
Messages
10
I have a Query that gives me the output as follows:

Code___DateofReview___Response___CountofReponse
AAA____12/19/2006_____0_________3
AAA____12/20/2006_____1_________2
AAA____12/20/2006_____0_________1
AAA____1/4/2007_______1_________2

The Field "Response" can either be 0 or 1. The Variable "Countofresponse" gives me the Count of response when it is 0 and 1 for a given Date of Review.

How do I modify this query so I can get a Percentage value added to this list. I would like to see the following result but not sure how to arrive at this:

Code___DateofReview___Response___CountofReponse___PercentValue
AAA____12/19/2006_____0_________3________________100%
AAA____12/20/2006_____1_________2________________66%
AAA____12/20/2006_____0_________1________________34%
AAA____1/4/2007_______1_________2________________100%

Can anyone help please?
 
what logic are you using to get the pecentages?
1-2 on line 2 gives 66% but
1-2 on line 4 gives 100%

Peter
 
There are 3 responses for the value 0 and no response for value 1 on 12/19/2006. Therefore Percent value is 100%.

There are 2 responses for 1 and 1 response for 0 on 12/20/2006. Therefore total countofreponse = 3. Individual percentages are 2/3 (for response 1) and 1/3 (for response 0).

There are 2 responses for value 1 and no response for value 0 on 1/4/2007. Therefore Percent value is 100%.
 
Last edited:
Ah... tricky... well not so...

Select Code, DateofReview, sum([CountofReponse]) as Total from [yourtable]
group by code,dateofreview

Now make a second query and Join it to this one, your percentage field is then
Percentage: CountofReponse/Total

I hope it is clear enough...
 

Users who are viewing this thread

Back
Top Bottom