Cummulative Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a query that displays the week number and the number of drawing created that week. I would like to know how to create a third column that will give me the cummulative number of drawings created up to that wee

Example
Week # DWG Created Cummulativ
**************************************
1 5
2 3
3 7 1
4 1 1

Thanking you in advance for your help

Daniel
 
The simplest way is to put the query in a report, add the # DWG field a
second time, and set the Running Sum property of the text box to Over All.
If you must do it in a query, you need to write a Subquery to return the
cumulative total. Something like:

SELECT [Week], [# DWG Created], (SELECT Sum([# DWG Created] FROM MyTable As
T2 Where T2.[Week] <= MyTable.[Week]) As Cumulative
FROM MyTable
Order By [Week];

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
Daniel P said:
Hello,

I have a query that displays the week number and the number of drawing
created that week. I would like to know how to create a third column that
will give me the cummulative number of drawings created up to that week
 
Back
Top