Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewuser20
Contributor III
Contributor III

Qlikview - Fill with previous value

I have a list of many products joined with a date_1 column. I need to add a new field to get the previous date_1 value or the value of the date_1 if there is no previous:

Example:

table source:

ProductsDate_1
163802/07/2018
163901/07/2018
163902/07/2018

 

What i want :

ProductsDate_1Date_2
163802/07/201802/07/2018
163901/07/201801/07/2018
163902/07/201801/07/2018

 

I used this script :

load
Distinct
Product,
Date_1,
if(product = Previous(product),Previous(Date_1),Date_1) as Date_2
Resident Table_source
order by Product,Date_1 asc;

what i get with my script:

ProductsDate_1Date_2
163802/07/2018-
163901/07/2018-
163902/07/201801/07/2018

 Any ideas how i can handle that ?

Thanks in advance

Labels (1)
1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi,

Maybe;

load
Distinct
product,
Date_1,
if(product = Previous(product),if(Previous(Date_1)=Null(),Date_1,Previous(Date_1)),Date_1) as Date_2
Resident Table_source
order by product,Date_1 asc;

Cheers,

Chris.

View solution in original post

2 Replies
chrismarlow
Specialist II
Specialist II

Hi,

Maybe;

load
Distinct
product,
Date_1,
if(product = Previous(product),if(Previous(Date_1)=Null(),Date_1,Previous(Date_1)),Date_1) as Date_2
Resident Table_source
order by product,Date_1 asc;

Cheers,

Chris.

qlikviewuser20
Contributor III
Contributor III
Author

It works ! 

thank you very much 😁