Forum Discussion
Anonymous
6 years agoNot applicable
Need to find difference between consecutive rows with Index sequence repeating based on criteria
Need to create a calculated column in Power Bi Named "Difference_Amount". There is an Index (sequence) column. But that restarts based on a new person's name. When the Index is 1 then "Difference_Amo...
- 6 years ago
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
But basically what you want is something like this:
Difference = VAR __Previous = MAXX(FILTER('Table',[PersonName] = EARLIER([PersonName] && [Index] = EARLIER([Index]) - 1),[Amount]) RETURN IF([Index]=1,0,[Amount] - [Previous])
Greg_Deckler
Community Champion
6 years agoSee 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
But basically what you want is something like this:
Difference =
VAR __Previous = MAXX(FILTER('Table',[PersonName] = EARLIER([PersonName] && [Index] = EARLIER([Index]) - 1),[Amount])
RETURN
IF([Index]=1,0,[Amount] - [Previous])