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

How to remove milliseconds from Timestamp field

Hi All

This is Qliksense...

I have  two tables like

Ammount:                 

ID,  Ammount

1,200

2,250

3,140

4,500

Transaction:

ID,  TransId, Typecode, Date, Timestamp

1, 1001,   Trs ,1/2/2018, 1/2/2018 01:21:45:375

1, 1001,    frs, 1/2/2018, 1/2/2018 01:21:45:376

1, 1002,    Trs, 12/2/2018, 12/2/2018 01:21:46:423

1, 1002,    Cef, 12/2/2018, 12/2/2018 01:21:46:521

1, 1003,     Trs , 15/2/2018, 15/2/2018 01:21:47:343

1, 1003,     Fdc ,15/2/2018, 15/2/2018 01:21:47:405

1, 1003,     efc ,15/2/2018, 15/2/2018 01:21:47:506


So here i make the timestamp Field Date(Timestamp,'DD/MM/YYYY hh:mm:ss') as Timestamp


here i am restricted the Milliseconds but still i am getting the duplicate records so that i am getting the duplicate record in my report

so how to remove the milliseconds and i want to get distinct records timestamp so that i can get the realistic report.


Expression : Sum({<Typecode={"Trs"}>}Ammount)/Sum({<Typecode-={'Trs'}>}Ammount)


In my report

ID, Date, Timestamp,Expression



so here whenever i added the timestamp field i am getting number of records so this is not correct so how can i solve ..


Can any help in this..

Here my  question is i wanat remove the millisecond and display upto seconds only...



Thanks in Advance






1 Reply
swuehl
MVP
MVP

Timestamp() or Date() will only format the field values' text part, not the underlying numeric part.

Use a rounding function or interpretation function to modify the numeric part:

Timestamp#(Timestamp(Timestamp,'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss') as Timestamp

or

Timestamp(Floor(Timestamp,Maketime(0,0,1)),'DD/MM/YYYY hh:mm:ss')  as Timestamp