Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get the above value to fill all zero value

IDValue
11
22
30
40
510
60
720

In the above table, I would like to fill the zero in LOAD Script. How can I make the table become Table B? Thanks

Table B

IDValue
11
22
32
42
510
610
720
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

try

  1. Temp
  2. LOAD *, 
  3. RowNo() as S.no 
  4.  
  5.  
  6. INLINE [ 
  7.     KPI, Year, Month, Value 
  8.     A, 2015, Jan 
  9.     A, 2015, Feb, 34 
  10.     A, 2015, Mar 
  11.     A, 2015, Apr, 55 
  12.     A, 2015, Jun 
  13.     A, 2016, Jan, 22 
  14.     A, 2016, Feb 
  15.     A, 2016, Mar, 29 
  16.     A, 2016, Apr 
  17.     A, 2016, Jun 
  18. ]; 
  19.  
  20.  
  21. Data: 
  22. LOAD *, 
  23.      If(Value, Value, Peek(Value1)) as Value1 
  24.  
  25.  
  26. Resident Temp Order By S.no Asc
  27. Drop table Temp

View solution in original post

2 Replies
Gysbert_Wassenaar

Like this:

LOAD

     ID,

     If(Value=0,Peek(Value),Value) as Value

FROM

     ...sourcetable...

     ;


talk is cheap, supply exceeds demand
Chanty4u
MVP
MVP

try

  1. Temp
  2. LOAD *, 
  3. RowNo() as S.no 
  4.  
  5.  
  6. INLINE [ 
  7.     KPI, Year, Month, Value 
  8.     A, 2015, Jan 
  9.     A, 2015, Feb, 34 
  10.     A, 2015, Mar 
  11.     A, 2015, Apr, 55 
  12.     A, 2015, Jun 
  13.     A, 2016, Jan, 22 
  14.     A, 2016, Feb 
  15.     A, 2016, Mar, 29 
  16.     A, 2016, Apr 
  17.     A, 2016, Jun 
  18. ]; 
  19.  
  20.  
  21. Data: 
  22. LOAD *, 
  23.      If(Value, Value, Peek(Value1)) as Value1 
  24.  
  25.  
  26. Resident Temp Order By S.no Asc
  27. Drop table Temp