Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Copy last value instead of fill wizard.

I have table like this:

accountDateValue
12010-01-010
12010-01-02NULL
12010-01-03NULL
12010-01-04NULL
12010-01-05NULL
12010-01-06NULL
12010-01-0739,62
12010-01-08NULL
12010-01-09NULL
12010-01-10NULL
12010-01-1112
12010-01-12NULL
12010-01-13NULL
22010-01-010
22010-01-02NULL
22010-01-03NULL
22010-01-04NULL
22010-01-05NULL
22010-01-065
22010-01-07NULL
22010-01-08NULL
22010-01-09NULL
22010-01-10NULL
22010-01-116
22010-01-12NULL
22010-01-13NULL
32010-01-010
32010-01-021
32010-01-03NULL
32010-01-04NULL
32010-01-05NULL
32010-01-06NULL
32010-01-07NULL
32010-01-08NULL
32010-01-09NULL
32010-01-10NULL
32010-01-112
32010-01-12NULL
32010-01-13NULL


And would like to recived like this:

accountDateValue
12010-01-010
12010-01-020
12010-01-030
12010-01-040
12010-01-050
12010-01-060
12010-01-0739,62
12010-01-0839,62
12010-01-0939,62
12010-01-1039,62
12010-01-1112
12010-01-1212
12010-01-1312
22010-01-010
22010-01-020
22010-01-030
22010-01-040
22010-01-050
22010-01-065
22010-01-075
22010-01-085
22010-01-095
22010-01-105
22010-01-116
22010-01-126
22010-01-136
32010-01-010
32010-01-021
32010-01-031
32010-01-041
32010-01-051
32010-01-061
32010-01-071
32010-01-081
32010-01-091
32010-01-101
32010-01-112
32010-01-122
32010-01-132


I want to replace all nulls with last amount. I know i can do it by Input file table wizard with "fill" option (above) but I don want to use it becouse this table is result of previous operation, and i should not store it. Anyone ?

1 Solution

Accepted Solutions
Not applicable
Author

Hi,
try this instead:

if(Value='NULL', peek(Value), Value) as Value

or

if(Value='NULL', previous(Value), Value) as Value

These functions should do about the same thing, please check help content for further syntax.

Good luck,

Jonas

www.optivasys.com

View solution in original post

5 Replies
renjithpl
Specialist
Specialist

Try,

if(Value='NULL', 0, Value) as Value

Not applicable
Author

Thanks for response.

I want to put instead of Null last value not 0 what you suggested.

Any ideas?

Not applicable
Author

Hi,
try this instead:

if(Value='NULL', peek(Value), Value) as Value

or

if(Value='NULL', previous(Value), Value) as Value

These functions should do about the same thing, please check help content for further syntax.

Good luck,

Jonas

www.optivasys.com

googel84
Partner - Creator III
Partner - Creator III

I never tried the function I'm suggesting you but, taking a look to re reference manual, I think it could be the right choice.

LOAD
account,
Date,
if (isNull(Value) = -1, previous(Value),Value)
FROM ...

Not applicable
Author

Thanks a lot, previous() doesn't work in this case (copy only one value don't copy value from previous if() iteration), but peek seems to be working 🙂