Forum Discussion
JustDavid
Helper V
3 years agoComparison against Previous Record
Hello, I'm new with DAXand my logic is still with Excel. Using Calculated Column with DAX (not in Power Query), how do I check my current record against previous record? Data Desired ...
Greg_Deckler
Community Champion
3 years agoJustDavid 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