Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
callmedaddy
Partner - Contributor II
Partner - Contributor II

Previous most recent non-zero value

Hello,

I'm trying to set the values of all the months indicating 0 with the previous most recent non-zero value.

For exemple, I have the following:

Jan 1042

Feb 0

Mar 12

Apr 0

May 0

 

And I want to achieve this:

Jan 1042

Feb 1042

Mar 12

Apr 12

May 12

 

I want to do this in script. Any solution?

Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Something  like this:

load *, If(Value = 0, Peek(NonZeroValue),Value) as NonZeroValue  inline [
Month, Value
Jan, 1042
Feb, 0
Mar, 12
Apr, 0
May, 0
];


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Something  like this:

load *, If(Value = 0, Peek(NonZeroValue),Value) as NonZeroValue  inline [
Month, Value
Jan, 1042
Feb, 0
Mar, 12
Apr, 0
May, 0
];


talk is cheap, supply exceeds demand
callmedaddy
Partner - Contributor II
Partner - Contributor II
Author

Works perfectly! Thank you, @Gysbert_Wassenaar !