Cuummulative Totals By Month (1 Viewer)

cabber

New member
Local time
Today, 00:20
Joined
Apr 19, 2020
Messages
2
I would like to create a query that will add the previous months figure as a cummulative total per month ie
Jan 2250
Feb 3000 This would be 5250
March 2000 This would be 7250
and so on

Any help greatly appriciated

Thank
 

Ranman256

Registered User.
Local time
Yesterday, 19:20
Joined
Apr 9, 2015
Messages
3,547
you can do it easily in a report.
set the query to the report, add another text box for Amt (this will be the running total amt)
set property to RUNNING SUM =OVER ALL, (or over group)
easy.

not so with query alone.
 

plog

Banishment Pending
Local time
Yesterday, 18:20
Joined
May 11, 2011
Messages
9,801
Can you post sample data from the table this will be built on? Include table and field names and enough data to cover all cases.
 

arnelgp

error reading drive A:
Local time
Today, 07:20
Joined
May 7, 2009
Messages
9,273
replace the tablename, fieldnames in this query with the
name of table,field you have:
Code:
SELECT
    Format([dateField],"mmm yyyy") AS MonthYear,
    DSum("amountField","yourTableName",
        "Format(datefield,'yyyymm') <= '" & Format([dateField],"yyyymm") &
        "' And Year(dateField)=" & Year([dateField])) AS RunningTotal
FROM yourTableName
GROUP BY
    Format([dateField],"mmm yyyy"),
    DSum("amountField","yourTableName","Format(datefield,'yyyymm') <= '" & Format([dateField],"yyyymm") &
    "' And Year(dateField)=" & Year([dateField])), Format([datefield],"yyyymm")
ORDER BY Format([datefield],"yyyymm");
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom