Forum Discussion

Irwan's avatar
Irwan
Super User
3 years ago
Solved

Need Advice: How to Calculate Date Diff between Two Exact Event

Hello Power BI Experts,

I need an advice about my dataset.

 

Below is my data.

My need is to find the next row that contains the exact string (description) for example "replace" with the exactly same equipment number as both in yelow color below, then substract the date of that row with date of current row (yellow color). And the process continue until last row of data (next date of the data will be substract to previous date of the data).

To make it simple, I want to calculate date difference between two events with exact description and equipment number.

 

Thank you and really appreciated for the help.

10 Replies

  • Share some data to work with (in a format the can be pasted in an MS Excel file) and show the expected result.

    • Irwan's avatar
      Irwan
      Super User

      hello Ahmedx ,

       

      here is sample of the data to make it simpler.

      The expected result is

      1. 298 (from 16-Dec-19 till 9-Oct-20), days difference between line 2 and line 9.

      2. 377 (from 9-Oct-20 till 16-Dec-19), days difference between line 9 and line 13.

      Those three events have exactly same description and equipment number.

      1600000001974Replace pulley8-Oct-19
      2600000002638Replace motor16-Dec-19
      3600000083190Replace pulley27-Jan-20
      4600000002693Replace pulley12-May-20
      5600000002616Replace pulley26-May-20
      6600000083190Replace pulley6-Jun-20
      7600000002638Replace pulley7-Jul-20
      8600000003106Replace pulley21-Sep-20
      9600000002638Replace motor9-Oct-20
      10600000002693Replace pulley29-Jul-21
      11600000002645Replace pulley19-Aug-21
      12600000002624Replace pulley15-Oct-21
      13600000002638Replace motor21-Oct-21

      Thank you and appreciated with the help.

  • Hello Ahmedx 

     

    thanks, everything is working, got all my need to shape my database.

     

    thank you and really appreciated for all the help.