Time Table

Hiroyuki Tamura
Hiroyuki Tamura used Ask the Experts™
on
I need to make a time sheet from Call History.
Basically Filter Employee and pick first call and last call time and create hours of work time.
Please advise.
Screenshot1.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
Select DateValue([Call Start Time]) as CallDate, Min([Call Start Time]) As CallStart, Max([Call End Time]) As CallEnd
From YourTable  Where [Call Start Time] >= PeriodStart and [Call End Time] < PeriodEnd +1
Group By DateValue([Call Start Time])

Save this query and call it qCallBase.  Then create a second query to calculate.  You can do the calculation in the first query but it just makes the expression more complicated.

Select *, DateDiff("n", CallStart, CallEnd) As CallMinutes
from qCallBase;

You can then convert minutes to hours and a fraction or hours and minutes, which ever works best for you.
Hiroyuki TamuraField Engineer

Author

Commented:
is this the way?
Screenshot1.jpg
Distinguished Expert 2017
Commented:
No.  You either need to create the two queries as I suggested where the second query refers to the first query rather than to the table OR the calculation need to refer to the Min(Call Start Time]) and Max([Call End Time]) fields.  The nested queries make the calculations neater and easier to read but otherwise aren't needed.
Implementation Specialist
Commented:
Assuming you have the agent's name in this same table, something similar to this should work (i have  a very similar example of this).

SQL for query:
SELECT [Call Log].[Agent Name], DateValue([Call Start Time]) AS Date, Min(TimeValue([Call Start Time])) AS StartTime, Max(TimeValue([Call End Time])) AS EndTime, DateDiff("n",[StartTime],[EndTime]) AS [Minutes Worked]
FROM [Call Log]
GROUP BY [Call Log].[Agent Name], DateValue([Call Start Time]);

Open in new window

This will give you a query result showing the agent, date, first start time that day, last end time that day, and the number of minutes between the start of first and end of last calls.
Hiroyuki TamuraField Engineer

Author

Commented:
thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial