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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
prajapatiamar38
Creator II
Creator II

PeeK()?

Hi Community,

I have two fields having values as below

 

idVal
139
2193
364
4123
596
6116
7126
872
9118
1099
11117
12148
13146
1488

and i want the output like this:

  

id         Val        val-1        val-2        val-3        val-4
1391936412396
21936412396116
36412396116126
41239611612672
59611612672118
61161267211899
71267211899117
87211899117148
911899117148146
109911714814688
11117148146880
121481468800
1314688000
14880000

How can i do this from backend pls suggest me.

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD * Inline [

id, Val

1, 39

2, 193

3, 64

4, 123

5, 96

6, 116

7, 126

8, 72

9, 118

10, 99

11, 117

12, 148

13, 146

14, 88

];

NewTable:

LOAD id,

  Val,

  Alt(Peek('Val', -1), 0) as Val1,

  Alt(Peek('Val', -2), 0) as Val2,

  Alt(Peek('Val', -3), 0) as Val3,

  Alt(Peek('Val', -4), 0) as Val4

Resident Table

Order By id desc;

DROP Table Table;

Output in a table box object:

Capture.PNG

View solution in original post

9 Replies
sunny_talwar

Try this:

Table:

LOAD * Inline [

id, Val

1, 39

2, 193

3, 64

4, 123

5, 96

6, 116

7, 126

8, 72

9, 118

10, 99

11, 117

12, 148

13, 146

14, 88

];

NewTable:

LOAD id,

  Val,

  Alt(Peek('Val', -1), 0) as Val1,

  Alt(Peek('Val', -2), 0) as Val2,

  Alt(Peek('Val', -3), 0) as Val3,

  Alt(Peek('Val', -4), 0) as Val4

Resident Table

Order By id desc;

DROP Table Table;

Output in a table box object:

Capture.PNG

prajapatiamar38
Creator II
Creator II
Author

Hi Sunny

Thanks its working perfect

Can you also tell me how can i do this in front end in straight table With only "id" and "val" fields.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

TableName:

LOAD id,

  Val,

  Alt(Peek('Val', -1), 0) AS Val1,

  Alt(Peek('Val', -2), 0) AS Val2,

  Alt(Peek('Val', -3), 0) AS Val3,

  Alt(Peek('Val', -4), 0) AS Val4

FROM DataSource

ORDER BY id des;

Regards,

Jagan.

jagan
Partner - Champion III
Partner - Champion III

Hi,

You can try in front end by Below() in straight table.

Regards,

Jagan.

senpradip007
Specialist III
Specialist III

Have a look at this.

sunny_talwar

This is a straight table:

Capture.PNG

Dimension: id

Expressions:

1) Val

2) Alt(Below(Val), 0)

3) Alt(Below(Val, 2), 0)

4) Alt(Below(Val, 3), 0)

5) Alt(Below(Val, 4), 0)

jagan
Partner - Champion III
Partner - Champion III

Please find attached file for solution in front end.

Regards,

Jagan.

prajapatiamar38
Creator II
Creator II
Author

Thanks everyone i got it

kavita25
Partner - Specialist
Partner - Specialist

PFA