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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewuser20
Contributor III
Contributor III

Next field Value

Hi,

I have a table structured like this:

  

Date_DébitDate_Crédit
01/02/2013
01/04/2013
12/04/2013
01/05/2013
10/06/2014
12/08/2014

i want to add a new column with end_date_of Debit to store the next field in Date_Crédit column like that:

   

Date_DébitDate_CréditDate_Fin_Débit
01/02/2013 01/04/2013
01/04/2013
12/04/2013
01/05/2013
10/06/2014 12/08/2014
12/08/2014

Any idea how can i do that in the script so i can calculate duration of debit ?

Thank you so much

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD RowNo() as Sort,

  *;

LOAD * Inline [

Date_DEBIT,  date_CREDIT

01/01/2013,

01/03/2013,

          ,          01/04/2013

];

FinalTable:

LOAD *,

  If(Len(Trim(date_CREDIT)) = 0, Alt(Peek('date_fin_debit'), Peek('date_CREDIT'))) as date_fin_debit

Resident Table

Order By Sort desc;

DROP Table Table;

View solution in original post

2 Replies
sunny_talwar

May be this:

Table:

LOAD RowNo() as Sort,

  *;

LOAD * Inline [

Date_Débit, Date_Crédit

01/02/2013,

,01/04/2013

,12/04/2013

,01/05/2013

10/06/2014,

,12/08/2014

];

FinalTable:

LOAD *,

  If(Len(Trim(Date_Crédit)) = 0, Peek('Date_Crédit')) as Date_Fin_Débit

Resident Table

Order By Sort desc;

DROP Table Table;


Capture.PNG

sunny_talwar

Try this:

Table:

LOAD RowNo() as Sort,

  *;

LOAD * Inline [

Date_DEBIT,  date_CREDIT

01/01/2013,

01/03/2013,

          ,          01/04/2013

];

FinalTable:

LOAD *,

  If(Len(Trim(date_CREDIT)) = 0, Alt(Peek('date_fin_debit'), Peek('date_CREDIT'))) as date_fin_debit

Resident Table

Order By Sort desc;

DROP Table Table;