Cumulative sum

G

Guest

Hi,

I have a table where the fields are Area (number), Month (text (rather than
date because some of the data in this field are "unknown")), and Power
(number).

An example of data in this table is:
Area Month Power
1 jun 2
1 jun 3
1 sep 2
1 sep 5
2 jan 6
2 jun 8
3 apr 10
3 apr 1
3 jun 2

I need a query that will provide the cumulative sum by Month of the Power by
Area.

Example of required output:
Area jan apr jun sep
1 5 12
2 6 14
3 11 13

I have tried building smaller queries and then using those in bigger queries
but I am getting nowhere. I've been trying to create this query in Query
Design rather than in the SQL view.

Any help will be GREATLY appreciated.

Thanks.
 
G

Guest

Try a CrossTab Query, such as

TRANSFORM Sum(TableName.Power) AS SumOfPower
SELECT TableName.Area
FROM TableName
GROUP BY TableName.Area
PIVOT TableName.Month;
 

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

Similar Threads

UNION and Crosstab query 5
Single Query 6
End of Month: Parameter Query? 3
Count Instances 1
Problem with Update Query 5
Parameter in Qry 2
Max Function 4
Crosstab, Quarter Sum isn't working 6

Top