Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator 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
Highlighted

Re: Time interval

Try this:

Interval(CurrentDate - PreviousDate, 'hh')

Highlighted

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

Highlighted
Creator II
Creator 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

Highlighted

Re: Time interval

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

Highlighted
Creator II
Creator II

Re: Time interval

Script

Highlighted

Re: Time interval

You can use Peek() or Previous() ?

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

Highlighted
Creator II
Creator II

Re: Time interval

Not working in  my Case

Would you please help on Chart

Highlighted

Re: Time interval

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

Highlighted
Creator II
Creator II

Re: Time interval

error.PNG