Averaging time in 15 minute increments

D

DavisGail

Is it possible to run a query with a time column and get the averages for
each 15 minute time increment?
 
B

BruceM

Since nobody has answered I suspect others are as puzzled as I about what
you are asking.
 
M

Michael Gramelspacher

Is it possible to run a query with a time column and get the averages for
each 15 minute time increment?


Maybe you are looking for something like this example:

SELECT DATEADD("n", (DATEDIFF("n", 0, [DataRates].Time_Stamp)\15)*15, 0) AS [Time Block],
Avg([DataRates].Throughput) AS [Avg Rate]
FROM DataRates
GROUP BY DATEDIFF("n", 0, [DataRates].Time_Stamp)\15)*15

Useing the table DataRates it groups the Time_Stamp column in 15-minute intervals and averages the
Throughput column.

Not tested.
 
J

John Spencer (MVP)

Wild guess

SELECT Minute(YourField)\15 +1 as Interval
,Avg(SomeField) as TheAverage
FROM SomeTable
GROUP BY Minute(YourField)\15 +1

That will group in 4 groups
1 - 00 to 14
2 - 15 to 29
3 - 30 to 44
4 - 45 to 59

If you want 1 to 15, 16 to 30, etc you will need to make a modification to the
expression you are using to calculate interval.

And yes, the \ is correct since I am using integer math to calculate the interval.

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

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