Results accumulation

Use this forum to post Vensim related questions.
Post Reply
KCL
Junior Member
Posts: 5
Joined: Fri Jul 07, 2006 3:25 pm

Results accumulation

Post by KCL »

Hi,

Is there a predefined function in Vensim that accumulates the results of an auxiliary variable over time? Suppose I have an auxiliary variable called Net Sales. How do I accumulate Net Sales in an auxiliary variable Net Sales To-Date?

EX.
If Net Sales for 3 periods are $5, $10, and $20, then
Net Sales To-Date for the 3 periods should be $5, $15, and $35.

Also, how do you reset Net Sales To-Date? Let's say Net Sales is $7 in the period 4 and I want Net Sales To-Date to reset at the start of the quarter. So, instead of $42, Net Sales To-Date would be $7 in the 4th period of this scenario .

I would greatly appreciate any help that points me in the right direction.

Thanks, Ken
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

most basically

cum sales = INTEG(sales,0)

to reset

cum sales with reset = INTEG(sales - reset,0)
reset = IF THEN ELSE(MODULO(Time,time periods per quarter) = 0,cum sales with reset/TIME STEP,0)

and if you want to get this period's sales

cum sales including this period = cum sales with reset + sales * TIME STEP
KCL
Junior Member
Posts: 5
Joined: Fri Jul 07, 2006 3:25 pm

Post by KCL »

Bob, thank you so much. This is great help.
Post Reply