Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
jonesbrown
Contributor

What is  Peek  Function give me an example

Hi All

I am new to Qlikview

What is  Peek  Function give me an example 

plz help.

1 Solution

Accepted Solutions
Highlighted
chrismarlow
Valued Contributor

Re: What is  Peek  Function give me an example

Hi,

You can use it to create running totals in script, so for example the following;

20191123_3.png

Comes from the toy script;

data:
load * inline [
Year, Month, Sales, Production
2016, Jan, 1000, 1500 
2016, Feb, 800, 1300 
2016, Mar, 600, 1400 
2016, Apr, 900, 1500 
2016, May, 500, 1400 
];

data_final:
NoConcatenate
LOAD
	RowNo() as row_no,
	If(RowNo()=1,0,peek('Stock_Open')+Previous(Production)-Previous(Sales)) AS Stock_Open,
	*
Resident data;

drop table data;

Cheers,

Chris.

View solution in original post

2 Replies
Highlighted
chrismarlow
Valued Contributor

Re: What is  Peek  Function give me an example

Hi,

You can use it to create running totals in script, so for example the following;

20191123_3.png

Comes from the toy script;

data:
load * inline [
Year, Month, Sales, Production
2016, Jan, 1000, 1500 
2016, Feb, 800, 1300 
2016, Mar, 600, 1400 
2016, Apr, 900, 1500 
2016, May, 500, 1400 
];

data_final:
NoConcatenate
LOAD
	RowNo() as row_no,
	If(RowNo()=1,0,peek('Stock_Open')+Previous(Production)-Previous(Sales)) AS Stock_Open,
	*
Resident data;

drop table data;

Cheers,

Chris.

View solution in original post

Highlighted
Partner
Partner

Re: What is  Peek  Function give me an example

The PEEK function is used to fetch the data present in any table available in your data model if you specify the table name and the number where the data is present.

If you did not specify any table name by default peek function will gives the previous row value as a result.

Kindly refer this help link which contains brief explanation and example https://help.qlik.com/en-US/sense/November2019/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecor...