As the Received_Date column is a date/time data type am I right in assuming
that it is being used to store the duration of the turn around time values,
with each value being less than 24 hours? The date/time data type is not
really intended for storing time durations; it actually stores a point in
time as a 64 bit floating point number with the integer part representing the
days and the fractional part the times of day, as an offset form 30 December
1899 00:00:00. Consequently any value entered as a time will be stored as a
value of zero point something, it not being possible to enter a time of 24
hours or more. So, subject to that constraint it will work after a fashion
for storing a time duration, but is not the ideal method for doing so.
If you sum these date time values you'll get the sum of the underlying
floating point numbers, which will give you the total number of days, and any
remaining part of less than a day as the value after the decimal point. The
summation will be over whatever the query is grouped by.
As you are summing the values in a computed column in the report's underlying
query, not in a computed control in the report, there should be no reason why
you cannot average its values in the report by adding an unbound text box o
the report footer with a ControlSource property of:
=Avg([TAT])
This should give you the average as the number of days, again with any
remaining part of less than a day as the value after the decimal point. If
you want to return this value as hours:minutes:seconds you can do so with the
following function:
Public Function TimeElapsed(dblTotalTime As Double) As String
Const HOURSINDAY = 24
Dim lngHours As Long
Dim strMinutesSeconds As String
'get number of hours
lngHours = Int(dblTotalTime) * HOURSINDAY + _
Format(dblTotalTime, "h")
' get minutes and seconds
strMinutesSeconds = Format(dblTotalTime, ":nn:ss")
TimeElapsed = lngHours & strMinutesSeconds
End Function
Ken Sheridan
Stafford, England
This is something that I took over. Unfortunately the person who built this
had much more knowledge of SQL and built everything in the reports on the
back end with the queries not showing in the objects. I have that field that
was built and works for for the daily Turn around Time but How or where do I
put the column at the end of the report for the average of all the days in
tat column going down? Yes receive_date is an actual date.
I have a TAT column built with formula of TAT:
Sum((QL_Production!Completed_Date-QL_Production!Received_Date))
[quoted text clipped - 8 lines]