I have a small private MS Access database to record details of a share portfolio. Dividends received are recorded and these are generally received twice per year. I wish to develop a query that will aggregate on a yearly basis the dividends received from each stock, however it is not a calendar year aggregation but a financial year aggregation that I am after. My financial year runs from 1st July to the 30th June the following year.
This if dividends were received such as
StockA 1 Sept 2011 $100
StockA 1 Mar 2012 $120
StockA 1 Sep 2012 $130
StockA 1 Mar 2013 $135
StockA 1 Sep 2013 $140
StockA 1 Mar 2014 $145
StockA 1 Sep 2014 $150
The query output would look like this for the Financial year ending
StockA 2012 $220
StockA 2013 $265
StockA 2014 $285
StockA 2015 $150
The query I have tried gets a listing but no aggregation. I would appreciate if someone could point me in the right direction please
many thanks
Code:
SELECT tbl_Div_DRP.ASXCode, Sum(tbl_Div_DRP.DivAmt) AS SumOfDivAmt, tbl_Div_DRP.DivDate
FROM tbl_Div_DRP
GROUP BY tbl_Div_DRP.ASXCode, tbl_Div_DRP.DivDate
HAVING (([DivDate]>=("07/01/" & Year([DivDate])) And [DivDate]<=("06/30/" & (Year([DivDate])+1))))
ORDER BY tbl_Div_DRP.ASXCode;