Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
sergey_maka8
Valued Contributor

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

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

sergey_maka8
Valued Contributor

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

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

Lookup function

Community Browser