I have a query that would have three files. One is a date field and I have a record for each day of the year. The other two are values. One I want to use as a criteria for the query and the other is a value for which I would like to get an average value for each year for about a twenty year period.
I know I can run twenty queries each with a different year and run an aggregate avg function and then build another one with these to put togher a table of years with daily averages. This just seems very roundabout.
I need a table that a query would produce as I want to export it to excel and combine it with other data for this time period for a chart.
Is there a simple way to do this in a query or is there some simple code that will do this [I don't know coding]
You could try creating a query that formats the date field as a year as a returned value. You would get one record for each year in your data table along with your query parameter and averaged value. All the work could be done in a single query.
The date formatting would be accomplished using the DATEPART function: