Forum Discussion
Fair-UL
4 years agoHelper II
Calculate Time between two dates on different rows
My issue is a bit tricky. I have this mock dataset with employees, levels, training group, and dates of start of level. not all employees are L2 in all training groups. I want to be able to calculate...
Greg_Deckler
4 years agoCommunity Champion
Fair-UL See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
Fair-UL
4 years agoHelper II
I am not sure I was able to follow this logic. it did not give me the result I was looking for