Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Load Ending Value of Previous Month to Beginning Value of Current Month?

I have a really complex sets of analysis that doing this at the back end would save a lot of time and effort.

So, here it goes. I have two tables: one containing the values(COMPANY,END_VALUE,PERIOD_ID) and another for the periods(YEAR,QUARTER,MONTH,PERIOD_ID) joining at period_id.

Thanks.

2 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Hi Elli,

try peek function. But you need to order data by COMPANY and PERIOD_ID before

Data:

LOAD *,

Peek(END_VALUE) AS START_VALUE INLINE [

COMPANY,END_VALUE,PERIOD_ID

A,1000,1

A,2000,2

A,2500,3

B,100,1

B,200,2

B,200,2

];

Calendar:

LOAD * INLINE [

YEAR,QUARTER,MONTH,PERIOD_ID

2013,1,Jan,1

2013,1,Feb,2

2013,1,March,3

];

Regards

Regards,
Sergey
SergeyMak
Partner Ambassador
Partner Ambassador

and another good example using lookup() and above() functions

Lookup function

Regards,
Sergey