Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

scotly-victor
Contributor II

Time interval

Hi Everyone ,

I have requirements I need get  interval between current date and previous date by hour

for example 1/30/2016 10:30:23 am

                   1/30/2016 12:30:30 pm

my output is  2 hours

Please help me out

13 Replies

Re: Time interval

Try this:

Interval(CurrentDate - PreviousDate, 'hh')

Re: Time interval

For you example:

=Interval(Timestamp#('1/30/2016 12:30:30 PM', 'M/D/YYYY h:mm:ss TT') - Timestamp#('1/30/2016 10:30:23 AM', 'M/D/YYYY h:mm:ss TT'), 'h')

Capture.PNG

scotly-victor
Contributor II

Re: Time interval

Both are same  Field


Example

               1/30/2016 10:30:23 am -   0 hh(ouput)

                   1/30/2016 12:30:30 pm-    2 hh(output)

                   1/30/2016 15:30:30 pm -     3  hh(output)


Like wise

Re: Time interval

Where are you trying to do this? Script or chart?

scotly-victor
Contributor II

Re: Time interval

Script

Re: Time interval

You can use Peek() or Previous() ?

Interval(DateTime - Previous(DateTime), 'hh')

scotly-victor
Contributor II

Re: Time interval

Not working in  my Case

Would you please help on Chart

Re: Time interval

Would you be able to provide few rows of data of how your data looks like?

scotly-victor
Contributor II

Re: Time interval

error.PNG