I am needing to calculate a month to date for the previous year in a report. Example: today is 02/18/10 and I have a month to date for today(current year). I need the report to also show month to date for 02/18/09. I believe I would be able to manipulate my current formula that figures the month to date for the current year, but I have been unsuccessful so far. I have the current year, month to date formula of: - =DAvg("[Occpncy Rate Skill Level]","[Service Guarentee Daily QRY]","Date Between #" & DateAdd("d",-Day([Date])+1,[Date]) & "# AND #" & [Date] & "#")
and I am using the grouping in the report for the month. I am pretty much a novice in comparison to most out here, any help would be appreciated. Thanks
7 6207
Hi there and welcome to Bytes
1) You should avoid using Date as a field name as it is a reserved word, and might end up causing you alot of headache.
2) To subtract a year from field myDate you would do: - myOldDate = DateAdd("yyyy", -1, myDate)
DateAdd's first parameter specifies that we wish to add years ("yyyy") but you could also use "d" for days, or "m" for months.
Second paramter -1 tells the function we wish to ADD -1 years, lastly the myDate is the date we wish to add the -1 year to.
3) Please remember to use the code tags around your code [code][/code]. It makes it a bit easier to read.
I may not be putting 2 & 2 together. I did get to show me the date one year ago. But, how do I get it to show me the data from a year ago? I want the report field to show the previous year data (year to date). I'm not sure if I can reference the field I already have that is doing the calculation already and have it display the previous year?
I've read your post but im not sure im making sense of what your trying to acomplish.
If you want all rows made in the last year, and you have a field called myDate you could select them using a query: - SELECT * from myTable where myDate>dateAdd("yyyy",-1,Date())
Sorry for the confusion. I will try to explain further here. I have a query Service Guarentee QRY with a field named Occpncy Rate Skill Level. From this I have a report that shows the daily volume, a month to date. I need to add a third field in the report that will show what the month to date on that day for the previous year was. Each would have a calculated result.
Day (1/25/10) MTD(1/1/10-1/25/10) MTD prior year (1/1/09-1/25/09)
The formula listed at the start calculates the MTD of the current year. So I am not sure if I can reference that and some how pull the data from the previous year or how to reference that data?? Hope this helps some.
What is a "Month to date"?
It is a running sum calculated from the start of a month to the current day of the month and would start over each month. Example 01/01/10 - 1/2/10, 1/1/10 - 1/3/10, 1/1/10 - 1/4/10, 1/1/10 - 1/5/10 and so on until the end of the month. I have this already calculated but I need to get the numbers of the MTD for the prior year (which has already been calculated). I need to some how reference that prior year data in my report.
I may have misunderstood the question. The month to day is the timeframe of the data I am calculating. I have this calculated already but I need to be able to reference the prior year data for the month to date. So I need to get the data that would show 2/1/09 - 2/24/09 (for current examle of time frame)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PMBragg |
last post by:
Thank you in advance. I'm trying to pull all inventory items from December
of the previous year back to 4 years for my accountant. I know this can be
done, but I'm drawing a blank. I've tried;
DateDiff("y",-4,DateIn) and get errors
Please any assistance would be greatly appreciated.
Michael
|
by: PMBragg |
last post by:
ORINGINAL Post
>Thank you in advance. I'm trying to pull all inventory items from December
>of the previous year back to 4 years for my accountant. I know this can be
>done, but I'm drawing a blank. I've tried;
>
>DateDiff("y",-4,DateIn) and get errors
>
>Please any assistance would be greatly appreciated.
>
|
by: Jeremy Wallace |
last post by:
I have some code that uses DateSerial to populate a couple of text boxes on
a form. I was doing some testing this afternoon and found that I get funny
values if the year supplied is 99. 98 works fine. 04 works fine. 1999 works
fine. 100 works fine. But 98 gives a funny value. Anyone have thoughts on
why, or how to re-form the dateserial call to deal with this?
Here's some results from the immediate window:
?(DateSerial(98 , 12+ 1, 1)) -...
|
by: Terencetrent |
last post by:
I have created a query that examines qarterly sales for 5 regions in
the country. The query contains data for the past 6 quarters for each
region and calculates the perecentage of total sales for the quarter
fo each region.
To help enhance the report I would love to include a comparison to of
current sales to previous quarter sales and a comparison of current
sales to sales a year ago. I am having a devil of a time creating a
query to...
|
by: ralph_noble |
last post by:
Greetings ... I have a table named Harms and Steven with a field named
inspector (text) and inspection date (date/time).
I need to count up how many times the inspector appears for any
inspections occured in 2004.
Here's what I have, but it's giving me problems ... what am I doing
wrong?
Thanks.
| |
by: Kenny |
last post by:
I am having issues with the "Date.ToOADate" method in
VB .NET. I understand that in VB6 the function DateSerial
gives an internal representation of the date.
When I use the DateSerial method in VB .Net, dragging the
mouse over to the statement, VB .NET reports the following
"Conversion from 'Date' to "Double' requires calling
the 'Date.ToOAdate' method.
When I tyoe this method in, the syntax checker undelines
|
by: jerry.ranch |
last post by:
I see that DateSerial can be used to "concatenate", in a way, three
fields DateSerial(year, month day) into a date field (if year , month
and date are numeric values). Unfortunately, my Month field is Text
(January, February etc).
What function is used to convert text month to numerical 1-12?
Thanks
Jerry
|
by: woooopa |
last post by:
Something like this...
MAX (DateSerial(!,!,!))
|
by: RZ15 |
last post by:
Hi,
I have a query that calculates the sum of branch transfers for the current quarter. Here is my Quarter-to-Date field:
QTD-In: Sum(CCur(IIf(="TRN" And Between DateSerial(Year(Date()),Int((Month(Date())-1)/3)*3+1,1) And DateSerial(Year(Date()),Int((Month(Date())-1)/3)*3+4,0),*!,0)))
Now, I need to make sure I understand the DateSerials, which I think I do but I'd rather be safe than sorry.
For DateSerial(Year(Date()),...
|
by: ringer |
last post by:
On a form I have a combo where a month is entered. It shows the month names
in column one, but it is bound to column two where each month's corresponding
number is, ie Jan=1, Feb=2, etc. So selecting April returns 4. Also on the
form I have a text box where a number is entered and used as the date of the
month in the aforementioned combo box.
I pull those numbers (month number from the combo and date number from the
text box) together...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |