I have a query that creates a list of cases and how many days it took to close the case. I need to calculate the average number of days it took to close a case based upon the user and the problem type.
Here's a sample of the data:
(This is what I need)
Advocate ProblemGroup #daysToClose AvgDaysToClose
Betty Housing 4 6.333
Betty Housing 7 6.333
Betty Housing 6 6.333
Betty Consumer 5 7.333
Betty Consumer 8 7.333
Betty Consumer 9 7.333
Her is my SQL statement that gets me the first 3 columns:
SELECT [trw Users].AdvocateLNFN, menu_problem.ProblemGroup, cases.open_date, cases.close_date, DateDiff("d",[open_date],[close_date]) AS [#ofDaysOpen]
FROM [trw Users] RIGHT JOIN (menu_problem RIGHT JOIN cases ON menu_problem.value = cases.problem) ON [trw Users].user_id = cases.user_id
WHERE (((cases.close_date) Between [Begin Date] And [End Date]))
ORDER BY [trw Users].AdvocateLNFN, menu_problem.ProblemGroup;
What do I need to do to calculate the average days to close?
Any help will be greatly appreciated.
Here's a sample of the data:
(This is what I need)
Advocate ProblemGroup #daysToClose AvgDaysToClose
Betty Housing 4 6.333
Betty Housing 7 6.333
Betty Housing 6 6.333
Betty Consumer 5 7.333
Betty Consumer 8 7.333
Betty Consumer 9 7.333
Her is my SQL statement that gets me the first 3 columns:
SELECT [trw Users].AdvocateLNFN, menu_problem.ProblemGroup, cases.open_date, cases.close_date, DateDiff("d",[open_date],[close_date]) AS [#ofDaysOpen]
FROM [trw Users] RIGHT JOIN (menu_problem RIGHT JOIN cases ON menu_problem.value = cases.problem) ON [trw Users].user_id = cases.user_id
WHERE (((cases.close_date) Between [Begin Date] And [End Date]))
ORDER BY [trw Users].AdvocateLNFN, menu_problem.ProblemGroup;
What do I need to do to calculate the average days to close?
Any help will be greatly appreciated.