Forum Discussion
waleed111
Helper V
6 years agoRow context
what is the row context? and what is its relation with EARLIER function? (i need explanation with some examples)
Greg_Deckler
Community Champion
6 years agoRow context is only enforced when you are in a calculated column situation or you are using ADDCOLUMNS in a measure. Basically means that the row adds context to your calculation.
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 __Previous = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Value])
RETURN
__Current - __Previous
EARLIER is the worst named function ever. Within a column formula it basically means "value in the current row". Many people eschew EARLIER and use something like VAR __Current = [Column], either way.