Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get the next value

Hi,

I have this set of data:

OPERATOR     DATE

Andrew             06/02/2018 08:35:41

Andrew             06/02/2018 08:37:12

Andrew             06/02/2018 08:41:01

I would like to add a new column to display the next value, like this:

OPERATOR     DATE                                 NEXT

Andrew             06/02/2018 08:35:41         06/02/2018 08:37:12

Andrew             06/02/2018 08:37:12         06/02/2018 08:41:01

Andrew             06/02/2018 08:41:01          .....

I've tried with Peek without success

Thank you in advance

1 Solution

Accepted Solutions
prat1507
Specialist
Specialist

Maybe this

Tab:

LOAD * Inline [

OPERATOR, DATE

Andrew, 06/02/2018 08:35:41

Andrew, 06/02/2018 08:37:12

Andrew, 06/02/2018 08:41:01

];

NoConcatenate

Tab1:

LOAD RowNo() as Rno,*

Resident Tab;

Drop Table Tab;

Left Join

LOAD Rno-1 as Rno,DATE as NEXTDATE Resident

Tab1;

View solution in original post

3 Replies
prat1507
Specialist
Specialist

Maybe this

Tab:

LOAD * Inline [

OPERATOR, DATE

Andrew, 06/02/2018 08:35:41

Andrew, 06/02/2018 08:37:12

Andrew, 06/02/2018 08:41:01

];

NoConcatenate

Tab1:

LOAD RowNo() as Rno,*

Resident Tab;

Drop Table Tab;

Left Join

LOAD Rno-1 as Rno,DATE as NEXTDATE Resident

Tab1;

alexandros17
Partner - Champion III
Partner - Champion III

Try This:

AAA:

LOAD *  Inline [

OPERATOR,     DATE

Andrew,             06/02/2018 08:35:41

Andrew,             06/02/2018 08:37:12

Andrew,             06/02/2018 08:41:01

];

BBB: NoConcatenate

LOAD * Resident AAA Order by DATE Desc;

DROP Table AAA;

CCC: NoConcatenate

LOAD OPERATOR,     DATE, Previous(DATE) as Next_DT Resident BBB;

DROP Table BBB;

Brownie
Contributor III
Contributor III

Heyy 

what if i want todays date as well in the middle. i want my data to be like thisScreenshot_13.png