Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have this table
ID | YEARWEEK | YEARWEEK|WEEK | WEEK |
1 | 201103 | 201103|13 | 13 |
2 | 201103 | 201103|13 | 13 |
3 | 201103 | 201103|13 | 13 |
4 | 201103 | 201103|13 | 13 |
5 | 201103 | 201103|13 | 13 |
6 | 201103 | 201103|13 | 13 |
7 | 201103 | 201103|14 | 14 |
8 | 201103 | 201103|14 | 14 |
9 | 201103 | 201103|14 | 14 |
201103 | 201103|15 | 15 | |
10 | 201103 | 201103|16 | 16 |
11 | 201103 | 201103|16 | 16 |
12 | 201103 | 201103|16 | 16 |
13 | 201103 | 201103|16 | 16 |
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.
ID | YEARWEEK | YEARWEEK|WEEK | WEEK |
1 | 201103 | 201103|13 | 13 |
2 | 201103 | 201103|13 | 13 |
3 | 201103 | 201103|13 | 13 |
4 | 201103 | 201103|13 | 13 |
5 | 201103 | 201103|13 | 13 |
6 | 201103 | 201103|13 | 13 |
7 | 201103 | 201103|14 | 14 |
8 | 201103 | 201103|14 | 14 |
9 | 201103 | 201103|14 | 14 |
7 | 201103 | 201103|15 | 15 |
8 | 201103 | 201103|15 | 15 |
9 | 201103 | 201103|15 | 15 |
7 | 201103 | 201103|16 | 16 |
8 | 201103 | 201103|16 | 16 |
9 | 201103 | 201103|16 | 16 |
10 | 201103 | 201103|17 | 17 |
11 | 201103 | 201103|17 | 17 |
12 | 201103 | 201103|17 | 17 |
13 | 201103 | 201103|17 | 17 |
Thanks! Regards
//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.
May be like attached sample. For week -17 you have to add a blank id accordingly.
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
can you help me?
//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.