Forum Discussion
DaniBi92
5 years agoNew Member
DATEDIFF with values in different Rows and Fields
Hi, is it possible to use a DATEDIFF formulas with values in different Rows and Fields(or another DAX formulas)? For example, i 've the following Data: ITEM STATUS DATE1 DATE2 XXX...
Greg_Deckler
Community Champion
5 years agoDaniBi92 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