A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hourly Avg



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2010, 07:27 PM posted to microsoft.public.access
Calif_Mike
external usenet poster
 
Posts: 1
Default Hourly Avg

I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike
  #2  
Old March 17th, 2010, 08:34 PM posted to microsoft.public.access
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Hourly Avg

A report can group things down to the minute and hour level.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Calif_Mike" wrote:

I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike

  #3  
Old March 17th, 2010, 08:58 PM posted to microsoft.public.access
Calif_Mike[_2_]
external usenet poster
 
Posts: 2
Default Hourly Avg

I need the data in a format that I can work with it in Excell.

"Jerry Whittle" wrote:

A report can group things down to the minute and hour level.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Calif_Mike" wrote:

I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike

  #4  
Old March 17th, 2010, 09:14 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Hourly Avg

Use the Hour function to get the hour and group by the DateValue (strip off
the time) and the Hour.

Group By DateValue(DateField), Hour(DateField)


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

Calif_Mike wrote:
I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike

  #5  
Old March 17th, 2010, 09:32 PM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Hourly Avg

Group the query on the date/time column formatted to the hour, e.g.

SELECT Format([SampleTime],”mm/dd/yyyy hh” AS [Sample Hour],
AVG([SiteName_EC]) AS [Average Quality]
FROM [YourTable]
GROUP BY Format([SampleTime],”yyyymmddhh”),
Format([SampleTime],”mm/dd/yyyy hh”);

The first group level is purely to ensure the correct order of the results.

Ken Sheridan
Stafford, England

Calif_Mike wrote:
I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

  #6  
Old March 17th, 2010, 09:35 PM posted to microsoft.public.access
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Hourly Avg

I am unfamiliar with that wizard, but it seems that you could sort on the
date/time field, decending, then use the Daily query and change it by
dividing by 24.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Calif_Mike" wrote in message
...
I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike



  #7  
Old March 17th, 2010, 10:26 PM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Hourly Avg

I am guessing but maybe like this using AVG([Quality]) AS [Average Quality]
if the field the reading is sotred in is named Quality --
SELECT [SiteName_EC], Format([SampleTime],”mm/dd/yyyy hh” AS [Sample Hour],
AVG([Quality]) AS [Average Quality]
FROM [YourTable]
GROUP BY [SiteName_EC], Format([SampleTime],”yyyymmddhh”),
Format([SampleTime],”mm/dd/yyyy hh”);

--
Build a little, test a little.


"KenSheridan via AccessMonster.com" wrote:

Group the query on the date/time column formatted to the hour, e.g.

SELECT Format([SampleTime],”mm/dd/yyyy hh” AS [Sample Hour],
AVG([SiteName_EC]) AS [Average Quality]
FROM [YourTable]
GROUP BY Format([SampleTime],”yyyymmddhh”),
Format([SampleTime],”mm/dd/yyyy hh”);

The first group level is purely to ensure the correct order of the results.

Ken Sheridan
Stafford, England

Calif_Mike wrote:
I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

.

  #8  
Old March 17th, 2010, 10:51 PM posted to microsoft.public.access
Calif_Mike[_2_]
external usenet poster
 
Posts: 2
Default Hourly Avg

This is getting me the average EC data that I need. The only problem is the
date and hour are coming out as text. If I run the query in as a Make Table
query and then set the Time by Hour field to Date/time format, it errors and
erases the dates and times.

SELECT DISTINCTROW Format$([Waterquality2008].["Time"],"mm/dd/yy hh") AS
[Time By Hour], Avg(Waterquality2008.["HardingDrain_EC"]) AS [Avg Of
"HardingDrain_EC"], Avg(Waterquality2008.["L55D22_EC"]) AS [Avg Of
"L55D22_EC"] INTO [Harding_L5 Hourly EC]
FROM Waterquality2008
GROUP BY Format$([Waterquality2008].["Time"],"mm/dd/yy hh");

"KARL DEWEY" wrote:

I am guessing but maybe like this using AVG([Quality]) AS [Average Quality]
if the field the reading is sotred in is named Quality --
SELECT [SiteName_EC], Format([SampleTime],”mm/dd/yyyy hh” AS [Sample Hour],
AVG([Quality]) AS [Average Quality]
FROM [YourTable]
GROUP BY [SiteName_EC], Format([SampleTime],”yyyymmddhh”),
Format([SampleTime],”mm/dd/yyyy hh”);

--
Build a little, test a little.


"KenSheridan via AccessMonster.com" wrote:

Group the query on the date/time column formatted to the hour, e.g.

SELECT Format([SampleTime],”mm/dd/yyyy hh” AS [Sample Hour],
AVG([SiteName_EC]) AS [Average Quality]
FROM [YourTable]
GROUP BY Format([SampleTime],”yyyymmddhh”),
Format([SampleTime],”mm/dd/yyyy hh”);

The first group level is purely to ensure the correct order of the results.

Ken Sheridan
Stafford, England

Calif_Mike wrote:
I have water quality data that is stored at 15 minute intervals. I would
like to query it as an hourly average. Date and time stored together as
mm/dd/yyyy hh:mm. Water quality is stored as "SiteName_EC".

The query wisard will develop daily, monthly and yearly but not hourly
queries.

Thanks,
Mike


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

.

  #9  
Old March 17th, 2010, 11:28 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Hourly Avg

On Wed, 17 Mar 2010 15:51:02 -0700, Calif_Mike
wrote:

This is getting me the average EC data that I need. The only problem is the
date and hour are coming out as text. If I run the query in as a Make Table
query and then set the Time by Hour field to Date/time format, it errors and
erases the dates and times.

SELECT DISTINCTROW Format$([Waterquality2008].["Time"],"mm/dd/yy hh") AS
[Time By Hour], Avg(Waterquality2008.["HardingDrain_EC"]) AS [Avg Of
"HardingDrain_EC"], Avg(Waterquality2008.["L55D22_EC"]) AS [Avg Of
"L55D22_EC"] INTO [Harding_L5 Hourly EC]
FROM Waterquality2008
GROUP BY Format$([Waterquality2008].["Time"],"mm/dd/yy hh");


If you in fact want a second table with the hourly averages - which I would
NOT recommend, in that it's storing data redundantly and also storing derived
data!!!! - you can create a calculated Date/Time field with an expression like
DateValue(Fix(CDbl([fieldname])*24)/24.)

I'm very queasy about the quoted strings in your fieldnames though!!!
--

John W. Vinson [MVP]
  #10  
Old March 18th, 2010, 12:12 AM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Hourly Avg

The following function would round a date/time value down to the nearest hour:


Public Function RoundToHour(dtmDateTime As Date) As Date

RoundToHour = CDate(Format(dtmDateTime, "yyyy-mm-dd hh:00:00"))

End Function

Ken Sheridan
Stafford, England

Calif_Mike wrote:
This is getting me the average EC data that I need. The only problem is the
date and hour are coming out as text. If I run the query in as a Make Table
query and then set the Time by Hour field to Date/time format, it errors and
erases the dates and times.

SELECT DISTINCTROW Format$([Waterquality2008].["Time"],"mm/dd/yy hh") AS
[Time By Hour], Avg(Waterquality2008.["HardingDrain_EC"]) AS [Avg Of
"HardingDrain_EC"], Avg(Waterquality2008.["L55D22_EC"]) AS [Avg Of
"L55D22_EC"] INTO [Harding_L5 Hourly EC]
FROM Waterquality2008
GROUP BY Format$([Waterquality2008].["Time"],"mm/dd/yy hh");

I am guessing but maybe like this using AVG([Quality]) AS [Average Quality]
if the field the reading is sotred in is named Quality --

[quoted text clipped - 26 lines]
Thanks,
Mike


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201003/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:32 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.