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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alexandrerich
Regular Visitor

Double data

Hi, 

 

I want to find how many hours trailers is at my warehouse.   In my document I know when a driver come whit a trailer and when is go out whit different trailer. 

 

In my PowerBI, I find how to calculate hours, but I want to filter trailers was already gone. 

 

Do someone have any suggestion, 

 

Thank's

 

2021-09-23 15_14_40-Remorque - Power BI Desktop.png2021-09-23 15_15_20-Remorque - Power BI Desktop.png

1 ACCEPTED SOLUTION

Hi @alexandrerich ,

 

You can use merge.

 

1.Duplicate the main table out of a new table, then retain the ID and time of the old table, and retain the ID and time of the new one, and then merge.

3.png

 

2.Then expand the table

5.png

 

3.Then add custom column to calculate the difference.

6.png

 

4.Convert the column to total hours.

7.png8.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@alexandrerich Not certain but seems like MTBF-type of problem. 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

 

Might help with sample data as text and explanation of which column is which.


@ 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...

Hi Greg, , 

 

The problem is my trailer OUT and IN is not in the same line.  See example

Date INTrailer InTrailer Out

Date out

2021-09-11 8:004834

4828

2021-09-12 8:00

2021-09-12 8:00154618362021-09-13 8:00
2021-09-12 8:00482315462021-09-13 8:00
2021-09-12 8:001625751892021-09-13 8:00
2021-09-12 8:006141348342021-09-13 8:00

 

And I dont want see trailer was go out. 

 

I find how to have how many hour trailers is here at the present time, But I want to erase trailers is gone. 

 

Hi @alexandrerich ,

 

You can use merge.

 

1.Duplicate the main table out of a new table, then retain the ID and time of the old table, and retain the ID and time of the new one, and then merge.

3.png

 

2.Then expand the table

5.png

 

3.Then add custom column to calculate the difference.

6.png

 

4.Convert the column to total hours.

7.png8.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank's, is exactly what I search

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.