Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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

    • Anonymous's avatar
      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,

  • dax's avatar
    dax
    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's avatar
      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