Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi guys
i have a table that contain this data
load * Inline
[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
Periodo | Value |
01/12/2012 | 200 |
---|---|
01/01/2013 | 300 |
01/02/2013 | 400 |
01/03/2013 | 500 |
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.
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.
thanks lukas for your answer, it really helpful, i'll apply your solucion in my app