Running Total

  • Thread starter Thread starter mahmad
  • Start date Start date
M

mahmad

Hi,

I would like to be able to have a running total for the month.

date sales
10/11/2009 100
11/11/2009 50
12/11/2009 10

therefor the total as of 12/12009 will be 160 and run until the end of the
month and then to start from zero and begin running the total again.

thanks for your help

M
 
therefor the total as of 12/12009 will be 160 - I believe you mean 12/1/2009.
Your words do not match the math -- Your words say to start over at the
begining of each month so on 12/1/2009 it should indicate 0 (zero). On 30
November it would be 150.

Or maybe I really did not understand what you were trying to say. If I am
wrong then explain further.
 
SELECT a.[date], a.sales, SUM( b.sales)
FROM tableName AS a INNER JOIN tableName AS b
ON a.[date] >= b.[date]
AND YEAR(a.[date]) = YEAR(b.[date])
AND MONTH(a.[date]) = MONTH(b.[date])
GROUP BY a.[date], a.sales



which assumes there is just one record per date.



Vanderghast, Access MVP
 
Back
Top