473,379 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Need the Date Expression to Determine Past 12 months of Data When Month and Year Entered

I am trying to develop a query which will determine the average costs
using a rolling average of the past 12 months of data. In other
words, if I entered the Ship Month of January and the Ship Year of
2004, I would want that month plus the preceding 11 months of data to
determine an average cost.

How can that criteria be entered in a query so that each month I can
get the most current 12 months of data to determine the average costs?

Thanks for your help!
Mary
Nov 12 '05 #1
2 3626
Enter a criteria of (fora date field...
Between dateadd("m",-11,[Enter Start Date]) and [Enter Start Date]

should work to give you a good range....
you can mess around with the Format and Cdate (or is it DateSerial??) to get
more specific...
for instance if a user enters 12/31/04...the original above would evaluate
to
between 1/31/04 and 12/31/04 ie. not give all of Jan,,
however..
using
Between #Month(dateadd("m",-11,[Enter Start
Date])/1/Year(dateadd("m",-11,[Enter Start Date]) ) and [Enter Start Date]
should give the whole of the month 11 months ago...

HTH
Mal.
"Mary" <Ma********@aol.com> wrote in message
news:db**************************@posting.google.c om...
I am trying to develop a query which will determine the average costs
using a rolling average of the past 12 months of data. In other
words, if I entered the Ship Month of January and the Ship Year of
2004, I would want that month plus the preceding 11 months of data to
determine an average cost.

How can that criteria be entered in a query so that each month I can
get the most current 12 months of data to determine the average costs?

Thanks for your help!
Mary

Nov 12 '05 #2
oops,,,

sorry, I should have tested rather than air-coded...

This will return the 1 day of the month - 11 months before the date
given....
FirstOf11MonthsBack: DateSerial(Year(DateAdd("m",-1,[Enter Start
Date])),Month(DateAdd("m",-1,[Enter Start Date])),1)

you could use it to make sure that the entire month of the given date is
used as well...
or consider running this query from a pop-up form that displays a drop down
calendar to select the starting month and year....

Mal.

"Mary" <Ma********@aol.com> wrote in message
news:db**************************@posting.google.c om...
I am trying to develop a query which will determine the average costs
using a rolling average of the past 12 months of data. In other
words, if I entered the Ship Month of January and the Ship Year of
2004, I would want that month plus the preceding 11 months of data to
determine an average cost.

How can that criteria be entered in a query so that each month I can
get the most current 12 months of data to determine the average costs?

Thanks for your help!
Mary

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bernard | last post by:
Hi, I have a problem with a CGI script (Perl) on a Win2000 server. The script is for sending E-cards and was written by Jason Maloney:...
2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
2
by: Mary | last post by:
I am trying to develop a query which will determine the average costs using a rolling average of the past 12 months of data. In other words, if I entered the Ship Month of January and the Ship...
13
by: vgame64 | last post by:
Hi, I have been struggling with writing a program for a few hours. The requirements are that: """You will be writing a program which will determine whether a date is valid in terms of days in that...
13
by: priyasmita_guha | last post by:
Here is a program- /* PROGRAM: To find the difference between two dates */ #include<dos.h> #include<stdio.h> #include<conio.h> #include<process.h> void valid_date(int,int,int); int...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
1
by: 848lu | last post by:
hey i really need help...i got this code....basically im suppose to make a calender that allows a user to type in month and year .... and the calander displays it on the scree using...
3
by: aashishn86 | last post by:
var weekend = ; var weekendColor = "#e0e0e0"; var fontface = "Verdana"; var fontsize = 1; var gNow = new Date(); var ggWinCal; isNav = (navigator.appName.indexOf("Netscape") != -1) ? true :...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.