Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
satyaban
Contributor III
Contributor III

How to find max value of timestamp and show same in Table chart for each user ?

Let me modify my question

I have username , timestamp

 satyaban , 20-Jan-2018 12:30:45
satyaban    , 21-Jan-2019 12:45:20
Satyaban  , 12-07-2020 10:45:25
Raghu , 08-08-2016 09:30:23

Basically I want to show this data in Table Chart in Qlik sense in below format i.t each user and its latest  timestamp value

username , timestamp

Satyaban  , 12-07-2020 10:45:25
Raghu , 08-08-2016 09:30:23

I have tried by taking username as dimension and below script in Measure of table chart

Max(Date(Floor(Timestamp#(timestamp,'DD-MMM-YYYY hh:mm:ss')),'DD-MMM-YYYY'))

which gives results only max date not actual fully timestamp value  as below . But I need same max timestamp value in timestamp column .

Script results (Only shows date value😌😞

username , timestamp

Satyaban  , 12-07-2020 
Raghu , 08-08-2016

 

Kindly suggest how to achieve same what should I write in measure section i.t modify the above script

Labels (3)
3 Replies
Taoufiq_Zarra
Master II
Master II

I propose the following solution:
first the loading script will become:

Data:

load 
alt( Timestamp#( timestamp , 'DD-MMM-YYYY hh:mm:ss' ),Timestamp#( timestamp , 'DD-MM-YYYY hh:mm:ss'  )) as New_timestamp,* inline [
username , timestamp
Satyaban,20-Jan-2018 12:30:45
Satyaban,21-Jan-2019 12:45:20
Satyaban,12-07-2020 10:45:25
Raghu ,08-08-2016 09:30:23
];


we add alt() to harmonize the dates

and in the graph you use the expression:

=Timestamp(Max(New_timestamp),'DD-MM-YYYY hh:mm:ss')

And there it is.

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
satyaban
Contributor III
Contributor III
Author

Hi Toufiq,

Thanks for awesome reply and its worked I am going to mark it solution but i had a small doubt 
all timestamp fields did not sort either in ascending/descending order .

Even in table chart graph for Measure field only sort by numeric /sort by alphabatically available whidh donot work well as

 

How to sort timestamp field of table chart in ascending/descending 

Screenshot 2020-01-17 at 12.41.23 PM.png

Taoufiq_Zarra
Master II
Master II

Hi,

if you can provide a sample , that'd be great.
otherwise you can add a field like this in the script:

alt( Timestamp#( timestamp , 'DD-MMM-YYYYY hh:mm:ss' ),Timestamp#( timestamp , 'DD-MMM-YYYYY hh:mm:ss' ))-Makedate(1900,01,01) as IDRank,

then Sort by expression ->=IDrank

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉