Hello everything,
This seems like a great forum and its my first time posting so Ill do my best to be as clear as possible...
I have a table, lets call it "MyTable", it contains 3 fields:
ID (Autonumber), LogDate (Date), Volume (currency)
I need to create a query based on this table with two running volume totals, Month to Date ("MTD_Volume") and Year to Date ("YTD_Volume").
I have been able to generate a running total using the expression:
YTDVolume: DSum("[Volume]","[MyTable]","LogDate-1 < " & Format([LogDate],"\#yyyy-mm-dd\#"))
The part where I am stuck is that I cant seem to figure out what to do to make the running total reset every month (or year).
So just to clarify (if any is needed) this is the query I am trying to get
MyQuery:
ID LogDate Volume YTD_Volume MTD_Volume
1- 1/2/09-----10------- 10 ---------10
2- 1/5/09-----20--------30 ---------30
3- 6/15/09--- 15--------45----------15
4- 4/10/10--- 30--------30----------30
5- 4/20/10--- 25--------55----------55
I know that this is an task better suited for excel, but I have to do it in access and the problem is fairly straight forward. If anyone can help me it would be massively appreciated and I would be happy to contribute however I can in the future...
Thanks in advanced!
This seems like a great forum and its my first time posting so Ill do my best to be as clear as possible...
I have a table, lets call it "MyTable", it contains 3 fields:
ID (Autonumber), LogDate (Date), Volume (currency)
I need to create a query based on this table with two running volume totals, Month to Date ("MTD_Volume") and Year to Date ("YTD_Volume").
I have been able to generate a running total using the expression:
YTDVolume: DSum("[Volume]","[MyTable]","LogDate-1 < " & Format([LogDate],"\#yyyy-mm-dd\#"))
The part where I am stuck is that I cant seem to figure out what to do to make the running total reset every month (or year).
So just to clarify (if any is needed) this is the query I am trying to get
MyQuery:
ID LogDate Volume YTD_Volume MTD_Volume
1- 1/2/09-----10------- 10 ---------10
2- 1/5/09-----20--------30 ---------30
3- 6/15/09--- 15--------45----------15
4- 4/10/10--- 30--------30----------30
5- 4/20/10--- 25--------55----------55
I know that this is an task better suited for excel, but I have to do it in access and the problem is fairly straight forward. If anyone can help me it would be massively appreciated and I would be happy to contribute however I can in the future...
Thanks in advanced!