I have a table full of items that each have a unique ItemID. There is another table with information on tests that are done on these items around once a month (some may have multiple tests per month and some may have none some months) and each test entry has a full date mm/dd/yyyy. I would like to display the average of one of the fields over all the data on a monthly basis. So assuming what I’m averaging is the item weight, I want to end up with a table like this:
Date AvgOfWeight
1/09 24.55
2/09 28.64
3/09 22.39
and so on…
I know that I can do a query to do averages and I can group the averages by certain criteria, but is there an easy way to group mm/dd/yyyy dates by month?
I love this strzero function that can be used here this way:
Results look like 2009-09 and can be ordered ascending, as they begin with the year. You’ll just have to create this strZero function as follows:
This was written on the fly. Please check all parameters (if any) for str, add error management, and adapt to your own needs. You might like to pass
x_myLongas a variant, in order to return a ‘0000’ string for example. This function has multiple other uses when converting numbers to fixed length strings.