Forum Discussion
chrisjames10
3 years agoRegular Visitor
Making a calculated column with two values from different days by state
Hello! I'm trying to figure out how to make a column in my table that displays the difference between the Allocated values (by state) from one day to the next. My table is updating daily with new...
- 3 years ago
maybe you can try this
column = var _last=maxx(FILTER('Table','Table'[state]=EARLIER('Table'[state])&&'Table'[date]=EARLIER('Table'[date])-1),'Table'[alllocated]) return 'Table'[alllocated]-_last
Greg_Deckler
Community Champion
3 years agochrisjames10 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