Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

peek vs previous

please any one explain the peek and previous

reddy

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello Reddy,

A very simple explanation is that Peek() is used to retrieve information already loaded in your datamodel, either in the current table or in any other table.

Names:

LOAD * INLINE [

Name, Code

A, 100

B, 200

C, 300

];

LET vThirdValue = Peek('Name', 2, 'Names'); // will return the third value for field "Name" in table "Names". Table Names must be already loaded.

Previous() is used when loading a table to get the previous record value for the field specified.

Names:

LOAD RecordID,

     Code,

     Previous(RecordID) AS PreviousID; // stores the previous value for RecordID in a new field called PreviousID

SQL SELECT RecordID, Code

FROM Source;

They are used sometimes together to make accumulations in script. There are a lot of examples in the forums.

Hope this helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

View solution in original post

2 Replies
Not applicable
Author

Refer to page No 413 of Qlik View reference manual

Miguel_Angel_Baeyens

Hello Reddy,

A very simple explanation is that Peek() is used to retrieve information already loaded in your datamodel, either in the current table or in any other table.

Names:

LOAD * INLINE [

Name, Code

A, 100

B, 200

C, 300

];

LET vThirdValue = Peek('Name', 2, 'Names'); // will return the third value for field "Name" in table "Names". Table Names must be already loaded.

Previous() is used when loading a table to get the previous record value for the field specified.

Names:

LOAD RecordID,

     Code,

     Previous(RecordID) AS PreviousID; // stores the previous value for RecordID in a new field called PreviousID

SQL SELECT RecordID, Code

FROM Source;

They are used sometimes together to make accumulations in script. There are a lot of examples in the forums.

Hope this helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica