Performing Totals on Last 10 Records

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];
 
B

Brian Camire

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top