Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Jason_1981
Frequent Visitor

How to calculate miles between tire install events?

Hello, 

 

I am trying to figure out a way to calculate the mileage between tire install events in my data. What I am thinking is a calculated column that would look at the Unit # ( Col B ) ignoring if unit is blank, and go back and see when was the last time that same unit had a tire put on in the same Position ( Col P ). When there is a match at a prior date using Date Out ( Col E ) for same unit and tire position, take the current row mileage ODO ( Col C ) and subtract the mileage at the prior event. That should tell me how many miles I got out of that tire. 

 

Here is a GoogleDoc link to sample worksheet:

https://docs.google.com/spreadsheets/d/1q8-cR0tmfaBkiiWGpN7Um3vGay0r1J1A/edit?usp=sharing&ouid=11116...

 

Thank You 

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Jason_1981 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/3395....
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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler, I am still trying to figure this out. I have made a little progress. I have at least come up with something that doesn't have errors and returns a result but unfortunately it is not returning any correct results. Any help would be appreciated. 

 

I was also wanting to filter out results when the Unit field is blank and when the Asy Cd field has a value of "3". 

 

Jason_1981_0-1666293913025.png

 

Thank You 

Thanks @Greg_Deckler. As this is my first attempt at a calculated column I am struggling with the syntax. I had one version that gave an error for expression referring to multiple columns. I tried adding in filters to match the unit and position for previous event. 

 

I tried to start over making it more simple to see if I could get anything and now stuck on a syntax error. Wherever I put the closing parentheses it gives a syntax error. 

Jason_1981_0-1666213655159.png

 

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.