Forum Discussion
Anonymous
3 years agoNot applicable
Calculate difference in time between dates in same column
Hi all, I have the following column, and I wish to calculate the difference between each row - ie the length of time between Row 2 (20/08/18) and Row 1 (18/01/2017). Any ideas on ...
tamerj1
Community Champion
3 years agoHi Anonymous
Please try
Days Difference =
VAR SelectedDates =
ALLSELECTED ( 'Table'[Date] )
RETURN
SUMX (
VALUES ( 'Table'[Date] ),
VAR CurrentDate = 'Table'[Date]
VAR FilteredDates =
FILTER ( SelectedDates, 'Table'[Date] < CurrentDate )
VAR PreviousDate =
MAXX ( FilteredDates, 'Table'[Date] )
RETURN
IF ( PreviousDate <> BLANK (), INT ( CurrentDate - PreviousDate ) )
)