Forum Discussion
Anonymous
3 years agoNot applicable
Calculate completed operation and date difference
Hi, I'm trying to calculate Completed? column based on serial #s, operations 10-30 = completed operation based on serial #. Then calculate the date difference between completed serials (10 and 3...
Greg_Deckler
Community Champion
3 years agoAnonymous So, yes, as a column:
Completed? Column =
VAR __serial = [serial #]
VAR __table = FILTER('Table',[serial #] = __serial && [Operation #] = 30)
RETURN
IF(COUNTROWS(__table)+0 > 0,"Y","N")
The second part is essentially MTBF, 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
3 years agoNot applicable
Never mind, I figured it out, thanks so much for your help!