Forum Discussion

andrewhann's avatar
andrewhann
Helper II
8 years ago
Solved

Production Gap

 

Can anyone help with the following - I want to measure the time difference between the LASTBOOKDATE and FIRSTBOOKDATE from one Works Order to the next (ie Production Gaps) on each Production Line.

 

Works Orders will not run consecutively across Production Lines so for each line orders will need to be sorted by FIRSTBOOKDATE (ie Start Time) and the gap measured from the LASTBOOKDATE (ie Finish Time) of the previous record on that production line.

 

Simple in excel- not so much in Power BI

  • fhill's avatar
    fhill
    8 years ago

    The last two references need to be FirstBookDate.
    MAXX = CALCULATE( MAXX(Table1,Table1[LASTBOOKDATE]), FILTER( ALL(Table1), Table1[PRODUCTION_LINE] = EARLIER(Table1[PRODUCTION_LINE]) && Table1[FIRSTBOOKDATE]< EARLIER(Table1[FIRSTBOOKDATE])))

15 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    Hi andrewhann

    is this the expected result?

     

    One case

    082959  911201A     L1    TimeDifference = 28/12/2016 10:41:00 - 28/12/2016 09:37:00

    • andrewhann's avatar
      andrewhann
      Helper II

      Sorry - it would have helped if my SQL were correct - there should only be one line per Works Order

       

      For consecutive orders (by FIRSTBOOKDATE) on the same production line I want the gap between last order finishing and this order starting

       

       

      So in this case - 30/12/16 19:36 - 30/12/16 19:09 ie production gap of 27 minutes on L2

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Community Champion

        Hi andrewhann

         

        This seems very much doable using a measure.

         

        Please post sample data in a table format so i can copy it and write and test the measure.

         

        Else you can share the file