Hi.
I
would like to have Access work out the percentage of total orders that took
over 5 days to process. How would I go about this please?
Since you haven't offered your table structure or query names, here's an
example, including the structure and names I've used:
Table: tblOrders
ID, Autonumber, primary key
StartDate, Date/Time, Start of order processing
EndDate, Date/Time, End of order processing
The query to calculate the number of processing days, qryProcessingDays, is
as follows:
SELECT ID, (EndDate - StartDate) AS ProcDays
FROM tblOrders;
.. . . where ProcDays is the number of days (in integer.decimal format) it
took to process the order. The query to calculate the "late" orders (those
that took more than 5.0 days) is as follows:
SELECT (SELECT COUNT(ID)
FROM qryProcessingDays
WHERE (ProcDays > 5.0)) AS Late,
COUNT(ID) AS Total,
(Late/Total) AS PctLate
FROM qryProcessingDays;
This query shows the number of orders that were five or more days late,
"Late," the total number of orders, "Total," and the percent of orders that
took more than five days to process, "PctLate."
Of course, this percentage assumes that all records have both a StartDate
and EndDate (where neither are NULL) in order to calculate a valid ProcDays
value. In other words, if there's an order that was started more than five
days ago, but hasn't been completed so doesn't have an EndDate, it won't be
counted as one of the "Late" orders.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.