Forum Discussion
Anonymous
5 years agoNot applicable
Calculate time between 2 dates in different rows
Hi guys, I need help with this: given the following set of data, calculate time between the 2 dates in different rows. (Please note that I am converting time and date into number format for dates an...
- Anonymous5 years ago
Hi Anonymous ,
Create an index column and use the following formula.
Column = var last_event = CALCULATE(MAX('Table'[EVENT FROM DATE&TIME]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1)) return IF(ISBLANK(last_event),BLANK(),'Table'[EVENT FROM DATE&TIME]-last_event)In addition, you could use DATEDIFF() function so that you don't have to convert time value to number value.
https://docs.microsoft.com/en-us/dax/datediff-function-dax
Best Regards,
Jay
Anonymous
5 years agoNot applicable
Hi Anonymous ,
Create an index column and use the following formula.
Column =
var last_event = CALCULATE(MAX('Table'[EVENT FROM DATE&TIME]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1))
return
IF(ISBLANK(last_event),BLANK(),'Table'[EVENT FROM DATE&TIME]-last_event)
In addition, you could use DATEDIFF() function so that you don't have to convert time value to number value.
https://docs.microsoft.com/en-us/dax/datediff-function-dax
Best Regards,
Jay