Forum Discussion
jobf
2 years agoHelper II
Difference between several dates in the same column
Hello. I need to calculate the difference between several dates in the same column. For example: Field Date P1 01/01/2024 P1 01/03/2024 P1 01/06/2024 P1 01/11/2024 P2 02/02/...
- Anonymous2 years ago
Hi jobf
Thanks for the reply from samratpbi .
jobf , you can try the following measure:
Difference = VAR _Previous = MAX('Table'[Date]) VAR _PreviousRowDate = CALCULATE( MAX('Table'[Date]), FILTER( ALLEXCEPT('Table', 'Table'[Field]), 'Table'[Date] < _Previous ) ) RETURN IF( ISBLANK(_PreviousRowDate), 0, MAX([Date]) - _PreviousRowDate )Output:
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jobf
2 years agoHelper II
Is there a way to do this without the PREVIOUS function?
Anonymous
2 years agoNot applicable
Hi jobf
Thanks for the reply from samratpbi .
jobf , you can try the following measure:
Difference =
VAR _Previous = MAX('Table'[Date])
VAR _PreviousRowDate =
CALCULATE(
MAX('Table'[Date]),
FILTER(
ALLEXCEPT('Table', 'Table'[Field]),
'Table'[Date] < _Previous
)
)
RETURN
IF(
ISBLANK(_PreviousRowDate),
0,
MAX([Date]) - _PreviousRowDate
)
Output:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.