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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jyothish8807
Master II
Master II

Peek Function

Hi All,

I am trying to get a an output using peek function , scenario is mentioned below :

NameDateAmount
a10/10/201220
b11/11/201255
c12/12/201244
d10/13/201320
e10/14/201370
f10/15/201310

Now i want an extra column which should come like this :

NameDateAmountComm
a10/10/20122020
b11/11/20125575
c12/12/201244119
d10/13/201320139
e10/14/201370209
f10/15/201310219

Regards

Jyothish KC

BI Consultant

Best Regards,
KC
1 Solution

Accepted Solutions
tresesco
MVP
MVP

If you have not yet got it right, please note one correction to my early post:

- single quotes around field name within peek function.

- and better put a check of rowno to avoid first row.

finally try:

Load

          If( Rowno()<>1,Amount+Peek('NewAmount'), Amount) as NewAmount

from <>;

Otherwise, Kaushik Solanki 's solution would also work with single qoutes correction.

View solution in original post

5 Replies
tresesco
MVP
MVP

Try like:

Load

          Amount+Peek(NewAmount) as NewAmount

from <>;

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try below code in script.

DATA:

Load * inline [

Name, Date, Amount

a, 10/10/2012, 20

b, 11/11/2012, 55

c, 12/12/2012, 44

d, 10/13/2013, 20

e, 10/14/2013, 70

f, 10/15/2013, 10

];

DATA2:

Load *,RangeSum(Amount,Peek([CommSum])) as CommSum

Resident DATA;

Drop table DATA;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
nizamsha
Specialist II
Specialist II

if u  want tis in straight table mean use accumulation it will be be down the expression tab and give the steps 100 so if u have 100 record

for eg

comm             result will be like this

5                     5

10                   15

15                    30

20                    50

25                   75

30                   105

so on               so on

tresesco
MVP
MVP

If you have not yet got it right, please note one correction to my early post:

- single quotes around field name within peek function.

- and better put a check of rowno to avoid first row.

finally try:

Load

          If( Rowno()<>1,Amount+Peek('NewAmount'), Amount) as NewAmount

from <>;

Otherwise, Kaushik Solanki 's solution would also work with single qoutes correction.

jyothish8807
Master II
Master II
Author

Thanx...

Best Regards,
KC