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

getting the latest record based on time stamp

Hi all

I have a requirement of fetching the Customer_ID with the latest time stamp, what ever being the ITEM he had purchased.

Header 1Header 2Header 3
IDITEMTIME_STAMP
123BOOKS8/18/2015 13:11
123PEN8/18/2015 13:58
123PENCIL8/19/2015 15:55
999PEN7/17/2013 16:44
777BOOKS7/27/2015 19:25
777PENCIL7/29/2015 12:01
777BOOKS7/29/2015 12:01

I HAVE TO DISPLAY THE RECORD BASED ON LATEST TIMESTAMP IN A STRAIGHT TABLE.

5 Replies
Clever_Anjos
Employee
Employee

FirstSortedValue(Customer_ID,-yourTimeStamp)

malini_qlikview
Creator II
Creator II

you can get the max(Timestamp) grouped on Customer_ID and join it to the original table in the script

or in front end you can use a calculated dimension as below

=Timestamp(Aggr(Max(Timestamp#(TIME_STAMP,'MM/DD/YYYY hh:mm')),ID))

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Create a straight table with the required fields, add and hide a dummy expression (e.g. something like =1, or =RowNo()), order by timestamp (Descending) and in Dimension Limits select "Show only" + "First" + value 1.

Best

Peter

Digvijay_Singh

Dimension - ID,Item

Exp - as mentioned below -

cust.PNG

Firstsortedvalue will miss the 777 as 2 values are same,not sure as of now how it can be handled in firstsortedvalue. For equal timestamp, do you want both values or anyone?

Anonymous
Not applicable
Author

Use the FirstSortedvalue() Function as Suggested by Anjos , It is working perfectly for your requirement. Thanks Anjo for telling this function which I really don't know before.