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

Load last row

How can I load just the last row from a table?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Order the table  descending on the field that determines what is the last row and load the first record:

Table1:

first 1

load * from table order by fieldx desc;


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Order the table  descending on the field that determines what is the last row and load the first record:

Table1:

first 1

load * from table order by fieldx desc;


talk is cheap, supply exceeds demand
farolito20
Contributor III
Contributor III
Author

Thanks

msteedle
Luminary Alumni
Luminary Alumni

Especially if you just need one or two values from that row (an index, a timestamp), it is likely faster to use the Peek function and not load/order the data. Negative numbers for Peek's second parameter count starting from the end of the table, so -1 would be the value for the last row.

LET v_LatestTimestamp = Peek('Timestamp Field', -1, 'Table with Timestamp');