Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
sureshqv
Esteemed Contributor III

Re: Get the above value to fill all zero value

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
2 Replies

Re: Get the above value to fill all zero value

Like this:

LOAD

     ID,

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

FROM

     ...sourcetable...

     ;


talk is cheap, supply exceeds demand
sureshqv
Esteemed Contributor III

Re: Get the above value to fill all zero value

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