Page 1 of 1

Aggregate by month

Posted: Thu Dec 06, 2007 6:51 pm
by Tod
Hi,
I'm new to the forum and relatively new to vensim.
I am working on a TBL tourism model that uses months. I am searching for a way to aggregate a variable so that it cumulates by month across the course of a model (ie all the data for jan cumulates, all data for feb cumulates, etc). I have tried the CUMULATE function but I am feeding in auxileries, not data. I can get away with using a series of delays but given that the model will be 20 years long, this is an ugly option.
Is there a function or other method I can use?
Any advice would be appreciated. Great to find a place for these kinds of questions.
Cheers, Tod

Posted: Fri Dec 07, 2007 2:06 am
by bob@vensim.com
You can use

cum january = INTEG(IF THEN ELSE(Modulo(Time,12) < 0.9999,value,0),0)
cum february = INTEG(IF THEN ELSE(modulo(Time+11,12)<0.9999,value,0),0)

and so on - with Pro/DSS

month: (m1-m12)
cum value[month] = INTEG(IF THEN ELSE(MODULO(time-month+11,12) < 0.999,value,0),0)

This assumes Time runs from 0 and 0 is January 1 - otherwise adjust accordingly.