Summing results of a Query

Vergy39

Registered User.
Local time
Today, 05:35
Joined
Nov 6, 2009
Messages
109
I am having trouble suming the results of a query. I have a query that determines the # of Workdays between 2 dates and is returned as days, hours, minutes. I need to sum these to get total and then divide by the number of issues to determine an average Turn around Time. Her is what i have so far:

SELECT Employees.LastName, fNetWorkdays([StartDate],[EndDate]) AS Workdays
FROM tblIssues INNER JOIN Employees ON tblIssues.EmployeeID = Employees.EmployeeID
GROUP BY Employees.LastName, fNetWorkdays([StartDate],[EndDate]), tblIssues.[Date Mailed]
HAVING (((tblIssues.[Date Mailed]) Between #5/2/2010# And #5/29/2010#));


Also, If someone could help me change to results from Days, Hours, Minutes to something like 2.5 days. That would help as well.

Any assistance is greatly appreciated.

David V.
 
GROUP BY Employees.LastName, fNetWorkdays([StartDate],[EndDate]), tblIssues.[Date Mailed]

Your grouping by the Workdays and even a field that is not in your select.
The second usually is an issue, the first is (part) of your problem.

Try this SQL instead:
Code:
SELECT Employees.LastName, Avg(fNetWorkdays([StartDate],[EndDate])) AS avgWorkdays
FROM tblIssues INNER JOIN Employees ON tblIssues.EmployeeID = Employees.EmployeeID
WHERE (((tblIssues.[Date Mailed]) Between #5/2/2010# And #5/29/2010#))
GROUP BY Employees.LastName

Converting your average workdays into 2.5 days or something alike will depend on what the function fNetWorkdays returns....
If that returns a proper date/time field... all you need to do is convert this date/time into a number using i.e. Cdbl(Avg(...))
 

Users who are viewing this thread

Back
Top Bottom