query by date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a query that groups my data by month, qtr or whatever
time frame I choose and average my other fields in the query. For example I
have a series of depth readings for a number of lakes and would like to give
average depths over a month or qtr period.
 
Add a calculated field to a query that gives you the month, or quarter, or
whatever, and then use that field for grouping. For example:

MonthValue: Month([DateFieldName])
 
cheers,

I used that function to pull out the month and year and groupby them, great!
but I can't see how to pull out the quarter or any other random grouping eg
2months, 7 months or 2 years. Do I need to make a custom calculation? How
would I do this.

I have also used the DatePart function to similar effect.

Ken Snell said:
Add a calculated field to a query that gives you the month, or quarter, or
whatever, and then use that field for grouping. For example:

MonthValue: Month([DateFieldName])

--

Ken Snell
<MS ACCESS MVP>

trevor said:
I would like to create a query that groups my data by month, qtr or whatever
time frame I choose and average my other fields in the query. For example I
have a series of depth readings for a number of lakes and would like to give
average depths over a month or qtr period.
 
You can use your own "custom" expression for those other things, if you know
the exact things you want. For example, to get the quarter (1, 2, 3, or 4):

QtrValue: ((Month([DateFieldName]) - 1) \ 3) + 1


--

Ken Snell
<MS ACCESS MVP>



trevor said:
cheers,

I used that function to pull out the month and year and groupby them, great!
but I can't see how to pull out the quarter or any other random grouping eg
2months, 7 months or 2 years. Do I need to make a custom calculation? How
would I do this.

I have also used the DatePart function to similar effect.

Ken Snell said:
Add a calculated field to a query that gives you the month, or quarter, or
whatever, and then use that field for grouping. For example:

MonthValue: Month([DateFieldName])

--

Ken Snell
<MS ACCESS MVP>

trevor said:
I would like to create a query that groups my data by month, qtr or whatever
time frame I choose and average my other fields in the query. For
example
I
have a series of depth readings for a number of lakes and would like
to
give
average depths over a month or qtr period.
 
got ya.

works a treat.

Ken Snell said:
You can use your own "custom" expression for those other things, if you know
the exact things you want. For example, to get the quarter (1, 2, 3, or 4):

QtrValue: ((Month([DateFieldName]) - 1) \ 3) + 1


--

Ken Snell
<MS ACCESS MVP>



trevor said:
cheers,

I used that function to pull out the month and year and groupby them, great!
but I can't see how to pull out the quarter or any other random grouping eg
2months, 7 months or 2 years. Do I need to make a custom calculation? How
would I do this.

I have also used the DatePart function to similar effect.

Ken Snell said:
Add a calculated field to a query that gives you the month, or quarter, or
whatever, and then use that field for grouping. For example:

MonthValue: Month([DateFieldName])

--

Ken Snell
<MS ACCESS MVP>

I would like to create a query that groups my data by month, qtr or
whatever
time frame I choose and average my other fields in the query. For example
I
have a series of depth readings for a number of lakes and would like to
give
average depths over a month or qtr period.
 

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

Back
Top