473,378 Members | 1,346 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,378 software developers and data experts.

3-year Comparison YTD

I need to run a report that calculates YTD commissions for the last
three years.

2005 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

2004 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

2003 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

I correctly displays the current year info, but gives me the entire
year for the previous years. How do I get Access to ignore months past
the current month in previous years?

Thanks.

Nov 13 '05 #1
3 1388

"Rosy" <kr****@portlite.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
I need to run a report that calculates YTD commissions for the last
three years.

2005 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

2004 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

2003 Cargo Dept Inland Dept Hull Dept Total
Jan
Feb

I correctly displays the current year info, but gives me the entire
year for the previous years. How do I get Access to ignore months past
the current month in previous years?

Thanks.


One way would be to use DatePart in the query.

WHERE DatePart("m", [PayDate]) <= DatePart("m", Date)

This would ignore months past the current month in previous years.

Nov 13 '05 #2
Okay, I see what that is supposed to do, but it gives me a data mistype
error. What am I doing wrong?

TRANSFORM Sum([qryComm-3yr].LineTotal) AS SumOfLineTotal
SELECT [qryComm-3yr].MonthClosed, [qryComm-3yr].YearClosed,
Sum([qryComm-3yr].LineTotal) AS Total
FROM tblDepartment INNER JOIN [qryComm-3yr] ON tblDepartment.DeptID =
[qryComm-3yr].DeptID
WHERE ((DatePart("m",[MonthClosed])<=DatePart("m","Date")))
GROUP BY [qryComm-3yr].MonthClosed, [qryComm-3yr].YearClosed
PIVOT tblDepartment.Department;

Nov 13 '05 #3

"Rosy" <kr****@portlite.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Okay, I see what that is supposed to do, but it gives me a data mistype
error. What am I doing wrong?

TRANSFORM Sum([qryComm-3yr].LineTotal) AS SumOfLineTotal
SELECT [qryComm-3yr].MonthClosed, [qryComm-3yr].YearClosed,
Sum([qryComm-3yr].LineTotal) AS Total
FROM tblDepartment INNER JOIN [qryComm-3yr] ON tblDepartment.DeptID =
[qryComm-3yr].DeptID
WHERE ((DatePart("m",[MonthClosed])<=DatePart("m","Date")))
GROUP BY [qryComm-3yr].MonthClosed, [qryComm-3yr].YearClosed
PIVOT tblDepartment.Department;


WHERE ((DatePart("m",[MonthClosed])<=DatePart("m","Date")))

In this line you are comparing the "month" to the "month" of the current
date, using the Date() function.
Change it to
WHERE ((DatePart("m",[MonthClosed])<=DatePart("m",Date)))
Notice there are no quotes around the Date function.
Nov 13 '05 #4

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

Similar topics

0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
29
by: Steven D'Aprano | last post by:
Playing around with comparisons of functions (don't ask), I discovered an interesting bit of unintuitive behaviour: >>> (lambda y: y) < (lambda y: y) False Do the comparison again and things...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
46
by: yadurajj | last post by:
Hello i am newbie trying to learn C..I need to know about string comparisons in C, without using a library function,...recently I was asked this in an interview..I can write a small program but I...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
37
by: spam.noam | last post by:
Hello, Guido has decided, in python-dev, that in Py3K the id-based order comparisons will be dropped. This means that, for example, "{} < " will raise a TypeError instead of the current...
7
by: bcutting | last post by:
I am looking for a way to take a large number of images and find matches among them. These images may not be exact replicas. Images may have been resized, cropped, faded, color corrected, etc. ...
0
by: SvenMathijssen | last post by:
Hi, I've been wrestling with a problem for some time that ought to be fairly simple, but turns out to be very difficult for me to solve. Maybe someone here knows the answer. What I try to do is...
1
by: Lars B | last post by:
Hey guys, I have written a C++ program that passes data from a file to an FPGA board and back again using software and DMA buffers. In my program I need to compare the size of a given file against...
11
by: Andrus | last post by:
I created dynamic extension methods for <= and < SQL comparison operators: public static IQueryable<TLessThanOrEqual<T>(this IQueryable<Tsource, string property, object value); public static...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.