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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
43918084
Creator II
Creator II

Peek Previous lookup all returns '-'

I have below table.  The first 2 fields are loaded table fields. The 3rd field is what I want to achieve.

The logic is if the Trade Num is the same as the previous, return the previous ACCTG DATE, otherwise returns blank

As I m a new to the tool, I first try to test if I can get the previous ACCTG DATE using

Peek(TRADE NUM, RowNo()-1)

or Previous (TRADE NUM)

or Lookup('ACCTG DATE', 'TRADE NUM', TRADE NUM, 'TABLE')

All returned -. 

Hope I can get some expert guidance

 

ACCTG DATETRADE NUMPrevious Acct Date
20191231503232H 
20200131503232H20191231
20191231503237H 
20200131503237H20191231
20191231960509H 
20200131960509H20191231
202001311096601H 
201912311096602H 
12 Replies
43918084
Creator II
Creator II
Author

Really sorry, I still get '-'.  Below is the script I use.  Sorry my fieldname is a bit long in the original version. I thought I should simplify it in my question . Hope you don't mind that I provide the actual fieldname for your review.

Load
"GLOBAL TRADE NUM (P0221)",
"ACCTG DATE (P0045)",

Rowno()-1 as row,
recno() as current,

Peek('"ACCTG DATE (P0045)"') as check,

 RESIDENT [LYCM]
 order by "GLOBAL TRADE NUM (P0221)","ACCTG DATE (P0045)" ;
 
Drop Table [LYCM];

marcus_sommer

Try it with a change to:

Load
"GLOBAL TRADE NUM (P0221)",
"ACCTG DATE (P0045)",

Rowno() as CurrentRecord,
recno() as SourceRecord,

Peek('ACCTG DATE (P0045)') as check,

 RESIDENT [LYCM]
 order by "GLOBAL TRADE NUM (P0221)","ACCTG DATE (P0045)" ;
 
Drop Table [LYCM];

 

43918084
Creator II
Creator II
Author

Thank you very much. It works now.  I really appreciate your patience.