Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Time | difference | User ID |
---|---|---|
13:10:15 | - | 1 |
09:15:01 | - | 2 |
08:15:01 | 01:00:00 | 2 |
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]
Hi,
have u tried like this?
Interval(Previous(Time)-Time,'hh') as Diff;
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]
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
Are you using a Order by statement to make sure that users are ordered before you use this if statement
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