Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last record

Hello all,

I need you help with small problem.

I have excel like this:

A   B

1  150

1  150

1  150

1  150

1  250

1  168

1  75

My question is how do I select only the last value?

I need that in script, not in expressions

Thanks in advance

1 Solution

Accepted Solutions
ashfaq_haseeb
Champion III
Champion III

You need to look at peek function.

Regards

ASHFAQ

View solution in original post

5 Replies
ashfaq_haseeb
Champion III
Champion III

You need to look at peek function.

Regards

ASHFAQ

ecolomer
Master II
Master II

You can put an counter, and use RecNo() function

tresesco
MVP
MVP

Table1:

Load *, RowNo() as RowNum from <>;

Let vMax=Peek('RowNum');


Noconcatenate

Final:

Load * Resident Table1 where RowNum=$(vMax);

Drop Table Table1;

simenkg
Specialist
Specialist

Table1:
load * inline [

A,   B

1,  150

1,  150

1,  150

1,  150

1,  250

1,  168

1,  75

];

let vLastA = Peek('A', -1,'Table1');

let vLastB = Peek('B', -1,'Table1');

Table2:

load '$(vLastA)' as A, '$(vLastB)' as B autogenerate 1;

drop table Table2;

sudeepkm
Specialist III
Specialist III

Another way of getting the last record and keeping it in a variable.

tab:

load * Inline [

A,B

1,150

1,150

1,150

1,150

1,250

1,168

1,75];

let vLastRecords = Peek('B',NoOfRows('tab')-1,'tab'); // can have another variable for field A