Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting the latest value based on timestamp

Hi All

I have three fields in a straight table

Employee_ID            Swipe_Time                            Meeting_No

ABC123                    28/09/2015 10:38:37                 meeeting2

ABC123                    28/09/2015 10:44:17                meeeting3

ABC123                    28/09/2015 09:12:07                meeeting1

QWE756                   12/03/2015 09:12:07                meeeting1

QWE756                   18/03/2015 06:10:00                meeeting2

IJK143                      14/09/2015 04:00:07               meeeting1

IJK143                       14/09/2015 09:30:07              meeeting2

I want the latest meeting attended by an employee based on timestamp(swipe_time),

Only the record with the maximum time stamp should be considered

My output should be

Employee_ID            Swipe_Time                            Meeting_No

ABC123                    28/09/2015 10:44:17                meeeting3

QWE756                   18/03/2015 06:10:00                meeeting2

IJK143                       14/09/2015 09:30:07              meeeting2




7 Replies
swuehl
MVP
MVP

Use employee id as dimension, then two expressions

=TimeStamp( Max(Swipe_Time) )

=FirstSortedvalue(Meeting_No ,-Swipe_Time)

edit:

Added Timestamp() formatting if needed

sunny_talwar

Try this:

Dimension: Employee_ID

Expression1: =TimeStamp(Max(Swipe_Time))

Expression2: =FirstSortedValue(Meeting_No, -Swipe_Time)

UPDATE: Sample attached:


Capture.PNG

Not applicable
Author


Hi thanks for the reply, but i'm not getting the result same as you. I'm getting null values in place of the second expression could you please help me

Not applicable
Author

Thanks for  the reply
I'm not getting the expected out and i'm getting null values in place of expression 2(this is the main thing i have to display) please help me, can we do any thing in the back end script to get the correct result

Not applicable
Author

Thanks for  the reply
I'm not getting the expected out and i'm getting null values in place of expression 2(this is the main thing i have to display) please help me, can we do any thing in the back end script to get the correct result

sunny_talwar

Would you be able to share your qvw or a sample qvw where you are seeing nulls?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Make sure that QlikView recognizes Swipe_time as a DateTime (Timestamp) field, and not just as a string. FirstSortedValue() will only return NULL values if the second parameter proves to be non-numeric.

We can't help you any further with the limited details from your original post and the message that "it doesn't work".