Accumulation query

  • Thread starter Thread starter Jon
  • Start date Start date
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??
 
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top