Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
santho_ak
Partner - Creator III
Partner - Creator III

Extract Date from Time & Calculate the time difference

Hi,

    I need to extract date. How to extract and calculate the time difference to display in a KPI

4 Replies
vvira1316
Specialist II
Specialist II

Hi,

Are you looking for following

LOAD [Start Date] as StartDate,
StopDate,
(
Floor(StopDate) - Floor([Start Date])) + (
(
Ceil(StopDate, 0.00001) - Floor(StopDate)) -
(
Ceil([Start Date], 0.00001) - Floor([Start Date]))) as TimeDelta
FROM
[..\Data\Time1.xlsx]
(
ooxml, embedded labels, table is Sheet1);

timediff.PNG

Expression

interval(TimeDelta, 'hh:mm')

Sokkorn
Master
Master

Hi Santhoh,

You may try this

If you prefer in load script:

Interval([StopDate]-[Start Date],'hh:mm:ss') AS [Time Difference]


If you prefer in expression:

Interval([StopDate]-[Start Date],'hh:mm:ss')

Sokkorn

santho_ak
Partner - Creator III
Partner - Creator III
Author

Thank you. I appreciate you for the time & solution.

santho_ak
Partner - Creator III
Partner - Creator III
Author

Thank you for the solution. It works fine.