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
Anonymous
Not applicable

Calculate duration between 2 rows

Hello,

 

I want to be able to establish the time between events for the same Work order and apply this delay to the next work center. Here is an example of the data and what I want to do :

 

Initial work table

Work orderDateHourWork centerOperation
1232020-05-0911:00A110
1232020-05-1013:00A220
1232020-05-1115:00A330
1232020-05-1217:00A140
4562020-05-0711:00A130
4562020-05-1013:00A240
4562020-05-1215:00A350

 

Here's what I want after

 

Work orderDateHourWork centerOperationDuration betweenNext work centerNext operation
1232020-05-0911:00A11026:00A220
1232020-05-1013:00A22026:00A330
1232020-05-1115:00A33026:00A140
1232020-05-1217:00A140#N/A#N/A#N/A
4562020-05-0711:00A13074:00A240
4562020-05-1013:00A24050:00A350
4562020-05-1215:00A350#N/A#N/A#N/A

 

I'll then be able to evaluate the average delay of each part between each operation / work center

Part#Next work centerNext operationAverage of Duration between
A1SA14026:00
A1SA22050:00
A1SA33038:00
Total A1S  40:24
Total  40:24

 

I know I can do it in Excel, but can this be done with Power BI ? I have 1,200,000 rows of data to analyse.

 

I can easily get the min and the max to calculate the total duration of each work order, but I need to drill down to the workcenter.

 

Thanks!

 

Dominic

 

5 REPLIES 5
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Please see the attached file with a solution.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

dax
Community Support
Community Support

Hi @Anonymous , 

You could refer to my sample for details. In addition, I don't understand the logic of second result table, could you please explain this to me?

Best Regards,
Zoe Zhi

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

Anonymous
Not applicable

The second result table comes from the average of the 1st result table. For exemple, the first work order when to the work center A2 2 times and waited 26 hours the 1st time and 74 hours the 2nd time, which gives an average of 50 hours.

 

Also, I can't open your .pbix since I'm only using the Power Pivot complement in Excel.

 

Part#Next work centerNext operationAverage of Duration between
A1SA14026:00
 Average A14026:00
 A22026:00
 A22074:00
 Average A22050:00
 A33026:00
 A33050:00
 Average A33038:00
Total A1S  40:24
Total  40:24

 

Dominic

Greg_Deckler
Super User
Super User

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


@ 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...
Anonymous
Not applicable

Thanks Greg, your MTBF calculation is really nice. I will surely use it.

 

If I understand correctly, it would gives me the average time after an event. In my case it's a little bit more complicated since I wanted to establish the time before the event.

 

I need to find out for each row to which work center the part is going in order to use your calculations. I can then make the average based on the "Next work center"

 

Regards,

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.

Top Solution Authors