Accumulation query

J

Jon

Greeting,

How to make the following table calculated in a query:
Step Value Accumulation
1 0.9 0.9
2 1 1.9
3 1.2 3.1
… ….. ….
The step 1 with value 0.9 will be sum in step 2 with value 1 and it will be
1.9, how to do that in query??
 
J

John W. Vinson

Greeting,

How to make the following table calculated in a query:
Step Value Accumulation
1 0.9 0.9
2 1 1.9
3 1.2 3.1
… ….. ….
The step 1 with value 0.9 will be sum in step 2 with value 1 and it will be
1.9, how to do that in query??

Use a Subquery:

SELECT [Step], [Value], (SELECT Sum([Value]) FROM yourtable AS X
WHERE X.Step <= yourtable.Step) AS Accumulation
FROM yourtable;

It may be easier in a Report, if the report is what you want at the end of the
day: just use two textboxes bound to the Value field, and in the one labeled
Accumulation set its Running Sum property to Over All (or Over Group, if
you're grouping by some field you haven't shown).
 
Top