Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
isciberras
Creator
Creator

interval time calculation dipaying lots of blanks

Hi Everyone,

I am having difficulty calculation the time different between 2 fields containing a timestamp. Using the script below for some reason it populates some of the table but leaves a lot of blanks for some reason.

Does anyone have any ideas why this might be happening?

Script:

interval (time - previous(time)) as [Difference]

Result:

TimedifferenceUser ID
13:10:15-1
09:15:01-2
08:15:0101:00:002
1 Solution

Accepted Solutions
sunny_talwar

Is result is what you want or is this what you are getting right now? Do you have another condition like this..

If([User ID] = Previous([User ID], interval (time - previous(time))) as [Difference]

View solution in original post

5 Replies
devarasu07
Master II
Master II

Hi,

have u tried like this?

Interval(Previous(Time)-Time,'hh') as Diff;

sunny_talwar

Is result is what you want or is this what you are getting right now? Do you have another condition like this..

If([User ID] = Previous([User ID], interval (time - previous(time))) as [Difference]

isciberras
Creator
Creator
Author

Thank you for your help.

Unfortunately the solution didn't work for me. I tried some new  things to try get the desired output alone however I can't seem to solve the problem.

The main issue of my result is that the "previous" keyword only works well if the previous user in the list of records was the same person in the previous record, however in this situation because thre are many people logging in at the same time, records could be far apart from each other and I don't know how to first sort out the records according to user then use the previous statement.

Would you by any chance happen to know how to do this as I am really stuck.

Thank you for your continuous help,

Isaac

sunny_talwar

Are you using a Order by statement to make sure that users are ordered before you use this if statement

isciberras
Creator
Creator
Author

Hi Sunny,

Thank you sorted everything using an order by statement and now things are working just fine.

Thank you very much for your help