Creating a Running Total for Each Record

FinanceGuy

New member
Local time
Today, 18:11
Joined
May 7, 2021
Messages
5
With the four columns on the left down below, I want to be able to populate the fifth column (Year to Date Revenue):

SubscriberMonthYearMonthly RevenueYear to Date Revenue
Apple12020$100$100
Apple22020$300$400
Apple122020$1,250$1,250
Pepsi12020$200$200
Pepsi22020$500$700
Apple32021$100$100
Apple42021$400$500
Pepsi12021$600$600
Pepsi22021$1000$1,600

What is the best function or query to get the Year to Date Revenue column populated?

I've been experimenting with DSum, but cannot seem to get it to work. I am open to creating a temporary table to calculate and get the fifth column and joining that table and appending the data from that column into my master table.
 
Dear Mr Gates, when you are done settling your ... personal business ... and have time for Access again, please give us Windowing.
 
in a query Join the table to itself on subscriber, alias one as A and the other as B.

bring down the fields from A and the monthly revenue from B

it is unfortunate you have month and year as separate values since this makes the next bit more complicated as you have to combine then to create a sortable order.

The calculation you need is (yearx100) + month. It is also unfortunate that both month and year are reserved words and should not be used as field names so you will need to enclose these in square brackets,

So the criteria you need is where the A calculated value is >= to the B calculated value.

now convert your query to an aggregate query (group by)

group on the A fields and sum the B field

you can also sort on the A subscriber and calculated value to get the right order. If this is for a report you will need to bring the A.calculated value through because sorting is done in the report - query sorts will be ignored
 
Dear Mr Gates, when you are done settling your ... personal business ... and have time for Access again, please give us Windowing.
good luck with that! don't forget to address his earthly-covered bunker that he sleeps in over there in washington state!
 

Users who are viewing this thread

Back
Top Bottom