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

Replacing 0 with last value in column per row

Hi all,

I have this quite specific following problem and hope to find some help here:

What I have:

JanFebMarAprMaiJun
Outlet 1 10015000
Outlet 201500100
Outlet 30015050
average 3,33510050

I like to replace 0 with the number from the column before (if that is also 0, than again the one before) per Outlet and getting the correct total average in the end.

What I want:

JanFebMarAprMaiJun
Outlet 1 101015151515
Outlet 201515151010
Outlet 300151555
average 3,338,3315151010

My goal is to show a chart with all months I have so far and with the correct total averange numbers.

Really thanks a lot for any help in advance!

7 Replies
Not applicable
Author

Try:

If(value=0, above(

Not applicable
Author

Try:


If(fieldname=0, above(fieldname), newfieldname)

sunny_talwar

What is the expression that you are using?

Not applicable
Author

If(fieldname=0, peek(fieldname), fieldname)

Not applicable
Author

Hi thanks, I tried this but it would just give me the value above once.

e.g. Outlet 1 in the example above would be like this:

from:

JanFebMarAprMaiJun
Outlet 110015000

to:

JanFebMarAprMaiJun
Outlet 11010151500

instead of:

JanFebMarAprMaiJun
Outlet 1101015151515

Also when I try to calculate the average QV wont identify one single Outlet have a 0 value in one month and just see the sum.

Not applicable
Author

Hi thanks, I tried this but it would just give me the value above once.

e.g. Outlet 1 in the example above would be like this:

from:

JanFebMarAprMaiJun
Outlet 110015000

to:

JanFebMarAprMaiJun
Outlet 11010151500

instead of:

JanFebMarAprMaiJun
Outlet 1101015151515

Also when I try to calculate the average QV wont identify one single Outlet have a 0 value in one month and just see the sum. In that case the Average is wrong since QV didnt count all Outlets.

Not applicable
Author

In the end I want a graph to show all months I have so far and with the correct total averange numbers:

sum(Products) / count( Outlet )  with month as my dimension.

if I dont have a number of one month per Outlet I like to take the number of the last month with a number.