View Single Post
  #14  
Old May 18th, 2010, 08:49 PM posted to microsoft.public.access.queries
SSi308
external usenet poster
 
Posts: 42
Default Need Help with Totals Query

The end result should be average number of calls per day by employee for a
specific time period. The first query asks for beginning and ending date. The
averages should reflect the data meeting the criteria in the first query.
Hope that makes sense. Not sure if this will help, but here is the SQL view
of the first query:

SELECT DailyCalls.Department, DailyCalls.Name, Count(DailyCalls.Name) AS
[Total Calls],
Abs(Sum(LengthOfCall=#12/30/1899 0:3:0#)) AS [Calls 3+],
Abs(Sum(CallDirection="OUT")) AS [Out Calls],
Abs(Sum(CallDirection="IN" Or (DailyCalls.CallDirection)="IN-AB" Or
(DailyCalls.CallDirection)="IN-I" Or (DailyCalls.CallDirection)="IN-T" Or
(DailyCalls.CallDirection)="IN-TF")) AS [In Calls],
Abs(Sum(CallDirection="OUT"))/Count([Name]) AS [Pt Calls Out],
Abs(Sum(CallDirection="IN" Or (DailyCalls.CallDirection)="IN-AB" Or
(DailyCalls.CallDirection)="IN-I" Or (DailyCalls.CallDirection)="IN-T" Or
(DailyCalls.CallDirection)="IN-TF"))/Count([Name]) AS [Pt Calls In],
Abs(Sum(LengthOfCall=#12/30/1899 0:3:0#))/Count([Name]) AS [Pt Calls 3+],
Abs(Sum(CallDirection="Out" And (DailyCalls.LengthOfCall)=#12/30/1899
0:3:0#))/Count([Name]) AS [Pt Calls Out 3+],
Abs(Sum(CallDirection="IN" Or (DailyCalls.CallDirection)="IN-AB" Or
(DailyCalls.CallDirection)="IN-I" Or (DailyCalls.CallDirection)="IN-T" Or
(DailyCalls.CallDirection)="IN-TF" And (DailyCalls.LengthOfCall)=#12/30/1899
0:3:0#))/Count([Name]) AS [Pt Calls In 3+]
FROM DailyCalls
WHERE (((DailyCalls.Date) Between [Start Date] And [End Date]))
GROUP BY DailyCalls.Department, DailyCalls.Name
HAVING (((DailyCalls.Name)"emptoexclude"));

Thanks.

Lori

"John Spencer" wrote:

It can be done. You need to be more specific it what you want.

Average number of calls by type.

Do you want
== average per day over a period of time by department
== average per day over a period of time by employee
== average for the entire period of time by department
== average for the entire period of time by employee
== something else?


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

SSi308 wrote:
John,

Many thanks for the help you have given. I was able to create and
successfully run the first query dealing with total calls and percents.

I now need to calculate the average calls each person made and received for
a particular time period.

My first Query, CallsPerDay, includes for each employee:
TotalCalls
3+Calls
OutCalls
InCalls
PtCallsOut (percentage of calls outgoing)
PtCallsIn (percentage of calls incoming)
PtCalls3+ (percentage of calls over 3 minutes)
PtCallsOut3+ (percentage of outgoing calls over 3 minutes)
PtCallsIn3+ (percentage of incoming calls over 3 mintues0

Now based on the number of calls per day per employee I need to calculate
the average number of: In; Out, and 3+ calls.

Can you help me out?

Lori


.