Work out the total time that something has happened for

Hi,

I have a Data table with multiple different vehicles (Serial Number - SN) in it, with data points on a specific DateTime. So the unique identifier is DateTime & SN. I'm trying to find a way to work out the number of minutes/amount of time that something happens for.

So, for example, a setting or flag is recorded when an event occurs, that record has a time stamp, I want to compare to the previous entry timestamp, work out the difference between them and display this in minutes!

I created a TimeSpan Column of the DateTime column

TimeSpan([DateTime])

Then I looked at using the OVER function:

[Time_Span] - Min([Time_Span]) OVER (Previous([DateTime]))

But this doesn't really seem to work!

(1) Answer

Login