Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Shahzad_Ahsan
Contributor II

How to calculate time difference

Hello Everyone

I want to calculate time difference.

It is calculating right but if the date is changed then it has problem.

You can see the second last row from the snapshot.

I have 4 fields in database startdate, starttime, enddate, endtime.

I want result 3:00 in second last row.

I have used this

=Interval (endtime - starttime, 'hh:mm')

Screenshot.jpg

1 Solution

Accepted Solutions
sumanta12
Contributor II

Re: How to calculate time difference

Hi 

Please try with this:

=IF(END_TIME>=START_TIME,

Interval(END_TIME-START_TIME,'hh:mm:ss'),TIME(Interval#('24:00:00','hh:mm:ss')-Interval(START_TIME-END_TIME,'hh:mm:ss'),'hh:mm:ss')

)

2 Replies
sumanta12
Contributor II

Re: How to calculate time difference

Hi 

Please try with this:

=IF(END_TIME>=START_TIME,

Interval(END_TIME-START_TIME,'hh:mm:ss'),TIME(Interval#('24:00:00','hh:mm:ss')-Interval(START_TIME-END_TIME,'hh:mm:ss'),'hh:mm:ss')

)

Shahzad_Ahsan
Contributor II

Re: How to calculate time difference

Thanks Sumanta

Community Browser