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: 
mikegrattan
Creator III
Creator III

Timestamp interval problem

I'm trying to use the Interval function to get the difference in minutes between two timestamps, but the result is in error.  Here's the function I'm using in my load script:

Interval(TimeStamp#(TimeStamp(EndLoadTimestamp, 'M/D/YYYY h:mm:ss'), 'M/D/YYYY h:mm:ss') - TimeStamp#(TimeStamp(BeginLoadTimestamp, 'M/D/YYYY h:mm:ss'), 'M/D/YYYY h:mm:ss'), 'm') as MinutesToLoad

Here's what the results look like:

    

Month(Date)OrderTypeSalesOrderBeginLoadTimestampEndLoadTimestampMinutesToLoad
MaySO211694435/30/2018 8:55:375/30/2018 8:58:120.00
MaySO211694145/30/2018 7:33:365/30/2018 7:33:370.00
MaySO211693445/30/2018 2:18:395/30/2018 2:19:260.00
MaySO211693425/29/2018 18:11:435/29/2018 18:11:560.00
MaySO211691915/29/2018 12:07:495/29/2018 12:08:140.00
MaySO211691755/29/2018 18:42:195/29/2018 18:42:190.00
MaySO211691395/29/2018 16:08:045/29/2018 16:58:590.04
MaySO211691235/29/2018 18:34:415/29/2018 21:38:010.13

Any ideas on how to get this work correctly?

Thanks.

1 Solution

Accepted Solutions
sunny_talwar

Try this

Interval(TimeStamp#(EndLoadTimestamp, 'M/D/YYYY h:mm:ss') - TimeStamp#(BeginLoadTimestamp, 'M/D/YYYY h:mm:ss'), 'm') as MinutesToLoad

View solution in original post

14 Replies
sunny_talwar

Try this

Interval(TimeStamp#(EndLoadTimestamp, 'M/D/YYYY h:mm:ss') - TimeStamp#(BeginLoadTimestamp, 'M/D/YYYY h:mm:ss'), 'm') as MinutesToLoad

mikegrattan
Creator III
Creator III
Author

Worked great.  Thanks!

richardm90
Partner - Contributor III
Partner - Contributor III

Do you know how this can be done as an IF Statement, I basically need to convert the times in Minutes to particular phrases. I've tried.....

=If(Interval(TimeStamp#([End Time]) - TimeStamp#([Start Time]), 'm') = '90','Basic')

So I want any appointments that are 90 mins long to show as Basic.

The (Interval(TimeStamp#([End Time]) - TimeStamp#([Start Time]), 'm') formula works correctly and shows the length of each appointment in Min's but the if statement is blank.

sunny_talwar

May be try this

=If(Interval(TimeStamp#([End Time]) - TimeStamp#([Start Time]), 'm') = MakeTime(1, 30), 'Basic')

richardm90
Partner - Contributor III
Partner - Contributor III

That works great, thank you!

richardm90
Partner - Contributor III
Partner - Contributor III

I cant seem to get this to work with any other time lengths?

I.e. I though 30 mins would be (0,30) or (30)

And 2 hours would be (2,00)

sunny_talwar

It is... 30 Minutes = MakeTime(0, 30) and 2 hours is MakeTime(2)

richardm90
Partner - Contributor III
Partner - Contributor III

Both return blanks :/. Am I missing something here.

sunny_talwar

I have no idea... may be share a sample