Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculate timeline period

Hi all,

I have a question abour a timeline calculation based on below table.

If the POSITION and the CTR_NR is the same and the TYPE is WAITING ESTIMATE or UNDER REPAIR, I want to calculate the time frame untill the next TIME_STAMP.

For example:

MNBU3337892 is on position WP4.19.

The TIME_STAMP of WAITING ESTIMATE is 26-10-2020 07:00.

The next timestamp after WAITING ESTIMATE is REPAIR COMPLETE on 26-10-2020 09:00

So, the outcome of the calculation is 2 hours.

I hope someone can help me with this!

John

 

positionctr_nrtypetime_stamptime_period (hrs)
WP4.19MNBU3447892Waiting Estimate26-10-2020 07:002
WP4.19MNBU3447892Repair Complete26-10-2020 09:00 
WP4.19SUDU8068773Waiting Estimate26-10-2020 22:006
WP4.19SUDU8068773Awaiting Authorisation27-10-2020 04:00 
WP4.19HLCU9852359Under Repair29-10-2020 11:003
WP4.19HLCU9852359Repair Complete29-10-2020 14:00 
  • Hey Anonymous ,

     

    I'm wondering if there is given order of types. Let's say

    1. Waiting Estimate

    2. Under Repair

    3. ...

     

    Regards,

    Tom

  • Anonymous 

    you can try to create a column

    Column = 
    VAR _time=minx(FILTER('Table','Table'[ctr_nr]=EARLIER('Table'[ctr_nr])&&'Table'[time_stamp]>EARLIER('Table'[time_stamp])),'Table'[time_stamp])
    return if('Table'[type]="Waiting Estimate"||'Table'[type]="Under Repair",DATEDIFF('Table'[time_stamp],_time,HOUR),BLANK())

6 Replies

  • Hey Anonymous ,

     

    I'm wondering if there is given order of types. Let's say

    1. Waiting Estimate

    2. Under Repair

    3. ...

     

    Regards,

    Tom

    • Anonymous's avatar
      Anonymous
      Not applicable

      TomMartens  good day,

       

      There is indeed a given order:

       

      Waiting Estimate can result in either repair complete or waiting estimate.

       

      Under repair can result in repair complete

       

      Thanks,

       

      John

       

      • TomMartens's avatar
        TomMartens
        Icon for Super User rankSuper User

        Hey Anonymous ,

         

        wondering how "Awaiting authorization" fits into this?

        Is there a typo or can there be more "Waiting estimates" before it becomes "Repair complete".

         

        Regards,

        Tom 

  • Anonymous 

    you can try to create a column

    Column = 
    VAR _time=minx(FILTER('Table','Table'[ctr_nr]=EARLIER('Table'[ctr_nr])&&'Table'[time_stamp]>EARLIER('Table'[time_stamp])),'Table'[time_stamp])
    return if('Table'[type]="Waiting Estimate"||'Table'[type]="Under Repair",DATEDIFF('Table'[time_stamp],_time,HOUR),BLANK())