Forum Discussion
Calculating time between two rows in the same column
- 6 years ago
🙂Anonymous
Diff = VAR __Previous = MINX ( FILTER ( 'Table', 'Table'[Date] = EARLIER ( 'Table'[Date] ) && 'Table'[Time] > EARLIER ( 'Table'[Time] ) ), 'Table'[Time] ) VAR __diff = __Previous - 'Table'[Time] RETURN __diff
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Anonymous
Try this
Diff =
VAR __Previous =
MAXX (
FILTER (
'Table',
'Table'[Date] = EARLIER ( 'Table'[Date] )
&& 'Table'[Time] < EARLIER ( 'Table'[Time] )
),
'Table'[Time]
)
VAR __diff = 'Table'[Time] - __Previous
RETURN
__diff
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
- Anonymous6 years agoNot applicable
nandukrishnavs This is close, it looks like it needs to be "shifted up" one row. So basically, the value I get in row 2 should be the value for row 1, etc.. You'll see that in the picture.
- nandukrishnavs6 years agoCommunity Champion
Anonymous you have to change colum formatting.
Set the data type as Time. Format as HH:mm
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂- Anonymous6 years agoNot applicable
nandukrishnavs Yeah, i got the format correct after I sent that, I was just in the wrong place.
How can I adjust the formula so that each row in that calculated column is essentially shifted up one row. per my last reply.
Thanks
- waleb3 years agoFrequent Visitor
pls, I am also stuck here. The value in row 2, should be in row 1