Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4 Week Average

Status
Not open for further replies.

Wrecker

Technical User
Aug 29, 2001
126
US
What expression would I need to put in the criteria of a field in a query to return a 4 wk avg from another field. the Data is entered daily, and I want the average for the last 30 entrys. Not sure how to write it...

Thanks in Advance
Wrecker
 
I can think of two ways of doing it.

1. In a new field use the access DAvg function to self refer to the query based on the last 30 days. So if your query was called qryData based on a table called tblData, the field you were averaging was called fldData, and the date field was called fldDate, the new field would be:

My Avg: DAvg("fldData","tblData","fldDate>=DateAdd('d',-30,Date())")

2. Base a GroupBy query on your original query that uses criteria to look at the last 30 days and averages out the data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top