Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
scotly-victor
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
sunny_talwar

Try this:

Interval(CurrentDate - PreviousDate, 'hh')

sunny_talwar

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

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

sunny_talwar

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

scotly-victor
Creator II
Creator II
Author

Script

sunny_talwar

You can use Peek() or Previous() ?

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

scotly-victor
Creator II
Creator II
Author

Not working in  my Case

Would you please help on Chart

sunny_talwar

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

scotly-victor
Creator II
Creator II
Author

error.PNG