You can use a calculated column like the below to compare each row against the previous then compute the difference in seconds using the DATEDIFF
function:
Difference in Seconds =
DATEDIFF (
'Table'[Time],
CALCULATE (
MIN ( [Time] ),
FILTER ( ALL ( 'Table' ), [ID] < EARLIER ( 'Table'[ID] ) )
),
SECOND
)
If you want to compare it against the previous ID time value, regardless if the time value is higher you can simply use:
Difference in Seconds =
DATEDIFF (
'Table'[Time],
CALCULATE (
MIN ( [Time] ),
FILTER ( ALL ( 'Table' ), [ID] = EARLIER ( 'Table'[ID] ) - 1 )
),
SECOND
)
Using LOOKUPVALUE
:
Difference in Seconds =
DATEDIFF (
'Table'[Time],
LOOKUPVALUE ( 'Table'[Time], 'Table'[ID], [ID] - 1 ),
SECOND
)
UPDATE: Adding the column from source via M Language.
Use something like this in a custom column:
=Table.AddColumn(#"YourLastStep", "Diff",
each
(try DateTime.From(#"YourLastStep"[Time]{[ID]-2})
otherwise DateTime.From([Time])) - [Time]
)
Hope it helps.