Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
HMUTUAL01
Contributor III
Contributor III

Peek and Previous

I am trying to create a dataset which looks back and populate the previous days balance but it doesn't seem to be populating the previous fields. Below is my query.

 

HMUTUAL01_0-1709919325217.png

 

Labels (2)
11 Replies
JonnyPoole
Former Employee
Former Employee

try previous() instead of peek() to grab the prior value

HMUTUAL01
Contributor III
Contributor III
Author

I adjust the editor to the following but still not retrieving any data

 

HMUTUAL01_0-1710171350678.png

 

JonnyPoole
Former Employee
Former Employee

Try exiting the script before the LEFT join and reloading to see if the previous() function is actually working. That will tell us if there is an issue with PREVIOUS or if its the LEFT JOIN that is causing the unexpected values.

HMUTUAL01
Contributor III
Contributor III
Author

I'm new, what do you mean by reloading? This is what I have so far.

 

HMUTUAL01_0-1710182432765.png

 

JonnyPoole
Former Employee
Former Employee

What I mean by 'Reload' is to click the 'Load' Button in the top right so as to reload the data in the app and process the proposed script changes.

HMUTUAL01
Contributor III
Contributor III
Author

Now I am getting an error but all I did was add  "Exit Script"

 

HMUTUAL01_0-1710185164063.png

 

JonnyPoole
Former Employee
Former Employee

ahhh... that could be a clue: the fact that its complaining about the field fund_plan_key.

Is that field definitely in the table you are performing a resident load from? Try commenting out the lines with previous() to ensure it loads correctly (and exits). Either the error is because of a missing field or mispelt field or its a logic issue of some kind. We're close!  

HMUTUAL01
Contributor III
Contributor III
Author

It ran  but this time created some synthetic keys. I'm going to change the fund_plan_key to the field I am trying to match against. 

 

HMUTUAL01_0-1710186063320.png

 

HMUTUAL01
Contributor III
Contributor III
Author

DS_PLAN_FUND_KEY=Previous(DS_Fund_Plan_Key) also gave me the same unfound error message