Calculation in a query

R

Robert

I have a table that contains job assignments. I want to, for a given date
range, calculate the percentage of job completion. So I want to take the
number of jobs closed from field [job status] and divide it by the total
number of jobs in the field [job status]. What is the best way to accomplish
this?

Thanks for the help
 
D

Dale Fye

Something like the following would work:

SELECT Sum(iif([job status] = "Closed", 1, 0))/Count([Job status]) as
PctClosed
FROM yourTable
WHERE [DateField] Between [Start Date] and [End Date]
 
K

KARL DEWEY

Try this --
SELECT (Sum(IIF([job status] = "Complete", 1, 0)) / Count([job status])) *
100 AS Percent_Complete
FROM YourTable
WHERE [YourDateField] Between [SomeDate] AND [AnotherDate];
 

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