Forum Discussion
Anonymous
5 years agoNot applicable
Accessing Previous Rows in Filtered Context
The data I'm trying utilize exists in the following context: Different equipment is on site for various quantities for varying amounts of time, as determined by dates on site. I need to...
Greg_Deckler
5 years agoCommunity Champion
Anonymous Should be posssible. 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:
Measure =
VAR __Current = MAX([Value])
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
You could use a measure like this in an ADDCOLUMNS statement within another measure to achieve what you want.