Forum Discussion
motzplo
7 years agoRegular Visitor
Timediff between rows depending on index
Hello all, I have the following problem and I hope some of you can help me. I would like to calculate the time difference between two rows, depending on the ID. Time difference between two rows o...
- 7 years ago
Hi motzplo,
Try this formula, please.
Column = VAR currentID = [ID] VAR currentIndex = [Index] VAR nextDatetime = CALCULATE ( MIN ( Table1[Datetime] ), FILTER ( 'Table1', 'Table1'[ID] = currentID && 'Table1'[Index] = currentIndex + 1 ) ) RETURN DATEDIFF ( [Datetime], nextDatetime, MINUTE )Best Regards,
Dale
v-jiascu-msft
7 years agoMicrosoft Employee
Hi motzplo,
Try this formula, please.
Column =
VAR currentID = [ID]
VAR currentIndex = [Index]
VAR nextDatetime =
CALCULATE (
MIN ( Table1[Datetime] ),
FILTER (
'Table1',
'Table1'[ID] = currentID
&& 'Table1'[Index]
= currentIndex + 1
)
)
RETURN
DATEDIFF ( [Datetime], nextDatetime, MINUTE )
Best Regards,
Dale