From: Jake D Jake on 17 May 2010 18:17 I have a lot of weather data for one month that is broken down by the minute. My end goal is to take the average hourly value of the column values (temp, humidity, etc.) and create one hourly averaged data point for each column. So, I am having trouble averaging integer values that occur multiple times within the same day and hour. Would like to apply this query to the entire table to average all integers for each day and hour. There are typically about 25 data points per hour (this number varies), for 31 days in August. I need to have one average hourly data point for every day in the month. Any help would be appreciated! Thanks.
From: John W. Vinson on 17 May 2010 18:36 On Mon, 17 May 2010 15:17:01 -0700, Jake D <Jake D(a)discussions.microsoft.com> wrote: >I have a lot of weather data for one month that is broken down by the minute. > My end goal is to take the average hourly value of the column values (temp, >humidity, etc.) and create one hourly averaged data point for each column. > >So, I am having trouble averaging integer values that occur multiple times >within the same day and hour. Would like to apply this query to the entire >table to average all integers for each day and hour. There are typically >about 25 data points per hour (this number varies), for 31 days in August. I >need to have one average hourly data point for every day in the month. > >Any help would be appreciated! > >Thanks. Try putting a calculated field in the query: ByTheHour: Format([datefield], "yyyymmddhh") This will have values such as 2009082111 for 11:00-11:59:59 AM August 21, and you can use it as the GROUP BY field in a totals query. -- John W. Vinson [MVP]
From: Jake D on 18 May 2010 15:14 John- Thanks for the tip, getting the date into that format was definitely the key. I struggled with the syntax for the group by stuff for a bit, but finally figured it out: SELECT Format([Date/Time],"yyyymmddhh") AS [Date Time], Avg([Hourly Data: Table].Temperature) AS [Temperature F], Avg([Hourly Data: Table].Humidity) AS [Humidity %] INTO Boise_Aug_Avg_Hourly_Information FROM [Hourly Data: Table] GROUP BY Format([Date/Time],"yyyymmddhh"); This worked out perfectly for me, thanks again! -jake "John W. Vinson" wrote: > On Mon, 17 May 2010 15:17:01 -0700, Jake D <Jake D(a)discussions.microsoft.com> > wrote: > > >I have a lot of weather data for one month that is broken down by the minute. > > My end goal is to take the average hourly value of the column values (temp, > >humidity, etc.) and create one hourly averaged data point for each column. > > > >So, I am having trouble averaging integer values that occur multiple times > >within the same day and hour. Would like to apply this query to the entire > >table to average all integers for each day and hour. There are typically > >about 25 data points per hour (this number varies), for 31 days in August. I > >need to have one average hourly data point for every day in the month. > > > >Any help would be appreciated! > > > >Thanks. > > Try putting a calculated field in the query: > ByTheHour: Format([datefield], "yyyymmddhh") > > This will have values such as 2009082111 for 11:00-11:59:59 AM August 21, and > you can use it as the GROUP BY field in a totals query. > > -- > > John W. Vinson [MVP] > . >
|
Pages: 1 Prev: Multiple table query displays only one record Next: Cumulative totals |