Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scenario using script

I have a source with

DateOutbal
1/1/2014100
4/1/2014400
2/1/2014500
3/1/2014200
5/1/2014150
6/1/2014450
7/1/2014300

And I need a Output Like this:

Date
Outbal
Inbal
1/1/2014100300(last value)
2/1/2014500100
3/1/2014200500
4/1/2014400200
5/1/2014150400
6/1/2014450150
7/1/2014300450
3 Replies
its_anandrjs
Champion III
Champion III

Try to load your table like this way

Source:

LOAD Date(Date,'D/M/YYYY') as Date,Outbal;

LOAD * Inline

[

Date, Outbal

1/1/2014, 100

2/1/2014, 500

3/1/2014, 200

4/1/2014, 400

5/1/2014, 150

6/1/2014, 450

7/1/2014, 300

];

NoConcatenate

NewTable:

LOAD

Date,

Outbal,

if(RowNo() = 1,Peek('Outbal',-1,'Source') ,Previous(Outbal)) as Inbal

Resident Source;

DROP Table Source;

Not applicable
Author

Hi Anand,

Thanks for your answer but in source we have date values not in a order so we need perform order by with date.plz find the source.

its_anandrjs
Champion III
Champion III

Then try with this and creating order by for Date

tmpSource:

LOAD * Inline

[

Date, Outbal

1/1/2014, 100

2/1/2014, 500

3/1/2014, 200

4/1/2014, 400

5/1/2014, 150

6/1/2014, 450

7/1/2014, 300

];

NoConcatenate

NewSource:

LOAD Date(Date,'D/M/YYYY') as Date,Outbal Resident tmpSource Order By Date;

DROP Table tmpSource;

NewTable:

LOAD

Date,

Outbal,

if(RowNo() = 1,Peek('Outbal',-1,'Source') ,Previous(Outbal)) as Inbal

Resident NewSource;

DROP Table NewSource;