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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Expression Help

HI All,

I have a table in Which i m getting Number of Temperature Values.

i want to pick Last Record from that temperature field.

I am using Expression like that in a table

Table:

load

Field1,

Field2,

Temperature,

Peek(Temperature,-1,'Table') as CurrentTemperature

From Path..

But not getting the expected output.

Regards

Abhay

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

I would suggest this approach - with a normal link (association) so you get efficient storage and quick execution:

2015-09-24 #1.png

View solution in original post

8 Replies
sunny_talwar

May be this:

Table:

load

Field1,

Field2,

Temperature,

FROM Source;

LastTemp:

LOAD LastValue(Temperature) as CurrentTemperature

Resident Table;

abhaysingh
Specialist II
Specialist II
Author

Hi Sunny,

Its not Working with multiple field...

How I will Link it to my Table.

sunny_talwar

Would you be able to share a sample with expected output?

abhaysingh
Specialist II
Specialist II
Author

I can Explain you

Table:

load

Asset,

Field2,

Temperature,

FROM Source;


This is kind of table i have and Assets has multiple temperature which is stored in Temperature Field


So I need to Pick Last Temperature as Current Temp of Asset.


Asset           Temp

ABC               -20

ABC               -10

ABC                 -5

ABC                   1



So Against ABC i Want 1 as Output.



Regards

Abhay

sunny_talwar

If you have multiple assets, try this:

Table:

LOAD Asset,

          Temperature,

FROM Source;

Join (Table)

LOAD Asset,

          LastValue(Temperature) as CurrentTemperature

Resident Table

Group By Asset;

sunny_talwar

See if this works:

Table:

LOAD * Inline [

Asset, Temp

ABC,  -20

ABC,  -10

ABC,  -5

ABC,  1

DEF,  -20

DEF,  -10

DEF,  -5

DEF,  10

];

Join (Table)

LOAD Asset,

    LastValue(Temp) as CurrentTemp

Resident Table

Group By Asset;

Capture.PNG

petter
Partner - Champion III
Partner - Champion III

I would suggest this approach - with a normal link (association) so you get efficient storage and quick execution:

2015-09-24 #1.png

sunilkumarqv
Specialist II
Specialist II

Its working

Data:

LOAD FirstSortedValue(Temp,-RecNo()) as Lastvalue;

LOAD * Inline

[Asset,Temp

ABC,-20

ABC,-10

ABC,-5

ABC,1

];