Calculation in a query

  • Thread starter Thread starter Robert
  • Start date Start date
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
 
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]
 
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];
 
Back
Top