Forum Discussion
gingerclaire
Helper III
4 years agoCalculating difference between two values in the same column - mileage
I have a spreadsheet from a car report that my team fill in monthly on different dates. Their mileage they enter is their odometer reading, so i need to work out the difference between that and their...
Greg_Deckler
Community Champion
4 years agogingerclaire 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
gingerclaire
Helper III
4 years agoI must admit I came across it when searching the boards for a solution/inspiration, but as a beginner, I couldn't keep up.