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

Store last value of a column in a varriable

Hi guys,

I have a table as follow:

ID     Amount

1       200

2       250

3       100

Need to store the last value of amount which is 100 in a variable..

Let me know your thoughts..

Best,

Alec

1 Solution

Accepted Solutions
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hiii,

TEMP:

ID     Amount

1       200

2       250

3       100

let vLastValue =  peek( 'Amount', -1, 'TEMP' ) ;

Hope this will help you.

-Nilesh

View solution in original post

5 Replies
Not applicable

try this,

    = FirstSortedValue(Amount,  -Amount)

Hope this helps you

Regards,

Ashutosh

nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hiii,

TEMP:

ID     Amount

1       200

2       250

3       100

let vLastValue =  peek( 'Amount', -1, 'TEMP' ) ;

Hope this will help you.

-Nilesh

VishalWaghole
Specialist II
Specialist II

Hi,

PFA file,

hope it will work for you.

you need to create one variable as  vMax

then assign max(ID) value to vMax

ant use this variable in set analysis as

=sum({<ID = {$(vMax)}>}Amount)

Thanks and Regards,

Vishal Waghole

MK_QSL
MVP
MVP

Please check enclosed file....

You can get first or last value from any table field using PEEK function...

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script and check the variable for value.

TEMP:

LOAD * INLINE [

ID,     Amount

1,       200

2,       250

3,       100];

let vLastValue =  peek( 'Amount') ;

Regards,

Jagan.