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: 
Not applicable

FILL WITH PREVIOUS VALUE

I have this table

   

IDYEARWEEKYEARWEEK|WEEKWEEK
1201103201103|1313
2201103201103|1313
3201103201103|1313
4201103201103|1313
5201103201103|1313
6201103201103|1313
7201103201103|1414
8201103201103|1414
9201103201103|1414
201103201103|1515
10201103201103|1616
11201103201103|1616
12201103201103|1616
13201103201103|1616

I need fill whit the yelloe lines the blue, when id is null add all previous week values.

Also can be 2 or 3 week to fill. no is a solution previous.

example i will expect for 3 blanks week.

   

IDYEARWEEKYEARWEEK|WEEKWEEK
1201103201103|1313
2201103201103|1313
3201103201103|1313
4201103201103|1313
5201103201103|1313
6201103201103|1313
7201103201103|1414
8201103201103|1414
9201103201103|1414
7201103201103|1515
8201103201103|1515
9201103201103|1515
7201103201103|1616
8201103201103|1616
9201103201103|1616
10201103201103|1717
11201103201103|1717
12201103201103|1717
13201103201103|17

17

Thanks! Regards

1 Solution

Accepted Solutions
tresesco
MVP
MVP

//Let vBlankCount=3;                  // this is where you define how many repeat you need

Load
iF(Len(trim(ID))=0 and peek('WEEK',-iterno()*2+1)=peek('WEEK',-iterno()-1),peek('NewID',-IterNo()*2+1),ID) AS NewID,
YEARWEEK,
YEARWEEK|WEEK,
WEEK


while Len(trim(ID))=0 and peek('WEEK',-iterno()*2+1)=peek('WEEK',-iterno())or iterno()=1;

LOAD ID,
    YEARWEEK,
    YEARWEEK|WEEK,
    WEEK
FROM
[https://community.qlik.com/thread/173345]
(html, codepage is 1252, embedded labels, table is @1);

Hope someone can implement it with a simpler way.

View solution in original post

4 Replies
tresesco
MVP
MVP

May be like attached sample. For  week -17 you have to add a blank id accordingly.

Not applicable
Author

In variable vBlankCount you say i define how many repeat. but the problem is that i don´t know how many i have to repeat.

I have to repeat all possible value in previous week

Not applicable
Author

can you help me?

tresesco
MVP
MVP

//Let vBlankCount=3;                  // this is where you define how many repeat you need

Load
iF(Len(trim(ID))=0 and peek('WEEK',-iterno()*2+1)=peek('WEEK',-iterno()-1),peek('NewID',-IterNo()*2+1),ID) AS NewID,
YEARWEEK,
YEARWEEK|WEEK,
WEEK


while Len(trim(ID))=0 and peek('WEEK',-iterno()*2+1)=peek('WEEK',-iterno())or iterno()=1;

LOAD ID,
    YEARWEEK,
    YEARWEEK|WEEK,
    WEEK
FROM
[https://community.qlik.com/thread/173345]
(html, codepage is 1252, embedded labels, table is @1);

Hope someone can implement it with a simpler way.