% less than 72 hours, rate calculation in Access

Lifeseeker

Registered User.
Local time
Yesterday, 16:53
Joined
Mar 18, 2011
Messages
273
Hi there,

I'm exploring this concept, and am seeking advice from you guys.

At the end of the day, I would like to have a query that does this rate-based calculation(x/y), and show the percent of patients receiving the right care within 72 hours.

x= represents the amount of record of interest. (those patients who received complete care with 72 hours), and y = total number of patients in hospital.

What should the code look like for this calculation? I know I should use the datediff function for the the time-based calculation, which is the datediff('h'[leaving hospital],[entering hospital]), but I"m not sure how the code should look like overall.

So if it is greater than 72 hours, then exclude it from the calculation.

Any thought/comment is much appreciated.
 
This would be the SQL to do that:

Code:
SELECT Format(Sum(IIf(DateDiff("h",[entering hospital],[leaving hospital])<=72,1,0))/Count([entering hospital]),"Percent") AS PercentOnTarget
FROM YourTableNameHere;

Be sure to replace 'YourTableNameHere' with your table's name. It essentially works like this--it takes your idea using DateDiff, then converts that to a 1 or 0 for each record based on if the difference is within 72 hours, it then adds all those 1's together to get the total seen within 72 hours, it then divides that by the total number of records which it obtains using the COUNT function and finally it formats the output as a percent.
 

Users who are viewing this thread

Back
Top Bottom