Forum Discussion
Calculation between periods
- 3 years ago
Anonymous Add an Index column in Power Query Editor or a Sequential week column like this: Sequential - Microsoft Power BI Community. Then you can use the MTBF pattern. 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
Anonymous Add an Index column in Power Query Editor or a Sequential week column like this: Sequential - Microsoft Power BI Community. Then you can use the MTBF pattern. 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
- Anonymous3 years agoNot applicable
thanks for your help, but I dont understand the first pass:
"VAR __Current = [Value]"This [Value] is the sum of Value B?
tks
- Greg_Deckler3 years ago
Community Champion
Anonymous In your case yes. The code is generic code, you have to adapt it to your particular table name and column names.