Performing Totals on Last 10 Records

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

I've got a query which calculates cycle times for a
process. Now I'm making a query to report the statistics
related to the cycletimes (ie max, min, and average cycle
times.). I would also like to include the statistics for
the last 10 events, so that I can compare the historical
data with the recent data to see if there is any
improvement.
Is there an easy way to do this?

Here is the SQL for my current query:

SELECT Count([Turnaround Tracking Query].BIN) AS NumData,
Avg([Turnaround Tracking Query].TotalCycleTime) AS
AvgTotalCycle, Min([Turnaround Tracking
Query].TotalCycleTime) AS MinTotalCycle, Max([Turnaround
Tracking Query].TotalCycleTime) AS MaxTotalCycle
FROM [Turnaround Tracking Query];
 
You might try something like this:

1. Create a query (say, named "Query1") to identify the last 10 events
(assuming you have a Date/Time field named "Your Date Field"):

SELECT TOP 10
[Turnaround Tracking Query].*
FROM
[Turnaround Tracking Query]
ORDER BY
[Turnaround Tracking Query].[Your Date Field] DESC

2. Create a second query like the one in your post, but base it on Query1
instead of "Turnaround Tracking Query".

Post back if want to calculate separate statistics on different groups of
data in your query (say, for different pieces of equipment).
 
Back
Top