Contributor

## Sum all values in a time series up to the current date

Is there a way to use TIMESUM or MOVINGSUM to sum all values in a time series up to the current date? Essentially creating an 'inception to date' calculation.

For example, if I have a monthly time series with the values 1,2,3,4,5 then I want my inception to date calculation to return 1,3,6,10,15.

I can achieve this by using MOVINGSUM(line item, -1000, 0) but I'm wondering if there is a better way to do this?

3 REPLIES 3
Moderator

## Re: Sum all values in a time series up to the current date

Using MOVINGSUM() in that manner would be best and works very well.  Using TimeSum() on a line item dimensionalized by Time is a no no as TimeSum used in this manner is heavier on performance.

Rob

Contributor

## Re: Sum all values in a time series up to the current date

Thanks for your reply. Just to confirm, is it really best practice to use -1000 or another large number in the MOVINGSUM calculation? Or is there a better way to do this?

Moderator

## Re: Sum all values in a time series up to the current date

So yes, movingsum() will work very well in this case.  Another way of doing this is to use YearToDate() for all years and then do lookups to get the prior year's values, but again, movingsum() would be better.

Rob