Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for
Did you mean:
Not applicable

Sum december last year with current year months

hi guys

i have a table that contain this data

[Periodo,Month,Year, Value

'01/10/2012',10,2012,500

'01/11/2012',11,2012100

'01/12/2012',12,2012,200

'01/01/2013',01,2013,300

'01/02/2013',02,2013,400

'01/03/2013',03,2013,500];

is posible tu sum the value from december from 2012 to the next months in 2013?

for example.

01/01/2013 = 300 + 200 (01/12/2012) =500

01/02/2013 = 400 + 200 (01/12/2012) =600

i need to put this data in a straight table with month as  dimension (only 2013 data)

i try to do this

sum({<Periodo={'>\$(=makedate(year(today())-1, 12))'}>}Value)

+  sum({<Periodo={'\$(=makedate(year(today())-1, 12))'}  >}Value)

but the problem is that not sum the value in the same month, my table looks like

01/12/2012 200 Periodo Value 01/01/2013 300 01/02/2013 400 01/03/2013 500
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello Jorge,

Since the Período Column is used, it can not set another Período in the same row.

To accomplish what you want, you should create a variable that returns sum of the last month of the past year, as in :

vSum = (  {<Periodo = { '\$(=Date( Addmonths( Max( Periodo ) , -1*(Num(  Month( Max(  Periodo ) ) ) ) ) ))' } >} Value )

And them use Value + vSum

So the results are:

 Periodo Sum + Dec 2012 Sum 01/01/2013 500 300 01/02/2013 600 400 01/03/2013 700 500

See the soliton Attached.

hope I could help.

3 Replies
Anonymous
Not applicable
Author

Hello Jorge,

Since the Período Column is used, it can not set another Período in the same row.

To accomplish what you want, you should create a variable that returns sum of the last month of the past year, as in :

vSum = (  {<Periodo = { '\$(=Date( Addmonths( Max( Periodo ) , -1*(Num(  Month( Max(  Periodo ) ) ) ) ) ))' } >} Value )

And them use Value + vSum

So the results are:

 Periodo Sum + Dec 2012 Sum 01/01/2013 500 300 01/02/2013 600 400 01/03/2013 700 500

See the soliton Attached.

hope I could help.

The problem you're running into is described in this document: Calculating rolling n-period totals, averages or other aggregations. It also has a possible solution.

talk is cheap, supply exceeds demand
Not applicable
Author