Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

How to display the latest record only of specific field based on date and time

I need to display the latest record only of specific SN based on date and time from transformed QVD. Table should return one row per SN.

https://drive.google.com/file/d/12nPTf9t7xoT7SSLtVg3Npx7GBQ3ANoAz/view?usp=sharing

Load

SN,

PI_Machine,

PI_Result,

PI_Date,

PI_time

From Raw_QVD

Labels (1)
5 Replies
Highlighted
Master
Master

Re: How to display the latest record only of specific field based on date and time

Hi

You can calculate the max datetime and then group by it with all the fields in the script.

Highlighted
Partner
Partner

Re: How to display the latest record only of specific field based on date and time

Hi,

you could try with

Load

SN,

FirstValue(PI_Machine) as PI_Machine,
FirstValue(PI_Result) as PI_Result,
FirstValue(PI_Date) as PI_Date,
FirstValue(PI_time) as PI_time
From Raw_QVD (qvd)
Group By
SN
order by
PI_Date desc,
PI_time desc
;

Highlighted
Contributor
Contributor

Re: How to display the latest record only of specific field based on date and time

Hi,

I encountered error on Order by. See below link.

https://drive.google.com/file/d/1gUO-U7V5_cGeNv50-A6KxRAIc39W3zSl/view?usp=sharing

 

Thanks,

Mhidz

Highlighted
Partner
Partner

Re: How to display the latest record only of specific field based on date and time

Hi,

sorry I forgot an important detail:

you could use order by only if you had loaded the table before.

So, you could load it and than, use the same script using resident

Highlighted
Contributor
Contributor

Re: How to display the latest record only of specific field based on date and time

Hi,

I'm loading my script using raw qvd file only not from database.