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: 
Przemyslaw_Rybacki
Contributor II
Contributor II

Using calculated cell from above

Hey All!

I need your help with the data set (as an example I put it in excel):

Przemyslaw_Rybacki_0-1632248611635.png

 

What I need is to fetch during of calculation for field "Purge" the fileds above calculated (for example cell D10).

Is there function in Qlik Sense which let me to do it? 

I know that above() works only in table/chart, but is there an option to do it in my script?

Gr

 

 

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

1) drop the single quotes.

2) you'll need to add if(rowno() = 1).  Because row 1 returns null, and you can't subtracting null after that resulting in null.  try this/update row1 as you need:

 If(rowno() = 1, 0, (Stock-30-peek(Purge,-1)) ) as Purge

View solution in original post

4 Replies
stevejoyce
Specialist II
Specialist II

You can use peek() for this.

Przemyslaw_Rybacki
Contributor II
Contributor II
Author

When I do like this, result is null for field "Purge"

Test:

Load

Day

Stock

Inbound

(Stock-30-peek('Purge',-1)) as Purge

From.....

 

stevejoyce
Specialist II
Specialist II

1) drop the single quotes.

2) you'll need to add if(rowno() = 1).  Because row 1 returns null, and you can't subtracting null after that resulting in null.  try this/update row1 as you need:

 If(rowno() = 1, 0, (Stock-30-peek(Purge,-1)) ) as Purge

Przemyslaw_Rybacki
Contributor II
Contributor II
Author

It's working, Thanks a lot!