Thanks for the quick response. This is real close, the problem I am having
is the years are off. For example my year 2000 quarter 2 data shows year
1999 with the correct amount. Their are also a few othter total amounts that
I am not sure where they are coming from, I am guessing because the year is
off. I did try modifying the example with + 10... Please let me know if you
need additional information.
Below is my select statement
SELECT Format(DateAdd("m",-10,[RebateDate]),"yyyy \Quarter q") AS Quarter,
Sum(RebateDetails.RebateAmount) AS totalAmount, RebateDetails.StoreNumber,
RebateDetails.RebateTypeID
FROM RebateDetails
GROUP BY Format(DateAdd("m",-10,[RebateDate]),"yyyy \Quarter q"),
RebateDetails.StoreNumber, RebateDetails.RebateTypeID
HAVING (((RebateDetails.StoreNumber)=33) AND ((RebateDetails.RebateTypeID)=1
Or (RebateDetails.RebateTypeID)=2 Or (RebateDetails.RebateTypeID)=3));
John Spencer said:
Adjust the date by adding months or subtracting months and then use
format to reutrn the desired string.
Format(DateAdd("m",-10,TheDate),"yyyy \Quarter q")
SELECT Format(DateAdd("m",-10,TheDate),"yyyy \Quarter q") as Quarter
, Sum(Amount) as TotalAmount
FROM SomeTable
GROUP BY Format(DateAdd("m",-10,TheDate),"yyyy \Quarter q")
'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
Toni wrote:
I would like to print a summary of quarterly information and am having
problems with the select statement
The table has a RebateAmount and RebateDate which is defined as a date/time
field.
First quarter is November - January and the 4th quarter is Aug - Oct.
Example data
01-Nov-07 500
01-Dec-07 200
01-Feb-07 350
01-Feb-08 450
01-Mar-08 100
01-Apr-08 200
01-May-08 600
.
.
the result I would like is
2007 Quarter 1 = 700
2007 Quarter 2 = 350
2008 Quarter 2 = 750
2008 Quarter 3 = 600
Any suggestions would be greatly appreciated
Thanks
Tsharp