Forum Discussion
Anonymous
4 years agoNot applicable
Measure for time difference between non-consecutive rows?
Hi, I'm fairly new to Power BI so forgive me if this is a common question, I couldn't find anything specific to non-consecutive, variable distance rows. I'm trying to calculate the total delivery...
- Anonymous4 years ago
Hi Anonymous ,
Please refer to my pbix to see if it helps you.
Create a measure.
Measure = VAR _min_arrive = CALCULATE ( MIN ( 'Table'[Arrive] ), FILTER ( ALL ( 'Table' ), 'Table'[Truck Name] = SELECTEDVALUE ( 'Table'[Truck Name] ) ) ) VAR _max_time = CALCULATE ( MAX ( 'Table'[Depart] ), FILTER ( ALL ( 'Table' ), 'Table'[Truck Name] = SELECTEDVALUE ( 'Table'[Truck Name] ) ) ) RETURN _max_time - _min_arriveIf I have misunderstood your meaning, please provide your desired output and pbix without privacy information.
Best Regards
Community Support Team _ Polly
Greg_Deckler
4 years agoCommunity Champion
Anonymous 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