Forum Discussion

erasm_w's avatar
erasm_w
Frequent Visitor
6 years ago

Tracking time difference and the change per change

I am trying to track the time it takes for a record to change it status and what status it changes to. I have a Prim_ID_FK that is the record identifyer which is the unique record, then there is a track ID which is just the primary key, process_description which shows the new description and track_date which show when it changed.

 

 

There is another table that contains the Prim_ID and the date the record was opened (Open_Date) of which the default is always Despatch.

 

I would like to be able to show something like:

Prim_ID_FK | Process_Description | Updated_Process_Description | Time Difference     |

      1                  Despatched                   Test                                          1 Day 15min (DateDiff([Open_Date],[Track_Date])

      1                  Test                                Quote                                      2 Day 20 min (DateDiff([Previous Track_Date],[Track_Date])

      2                  Despatched                   Test                                          1 Day 10 min

 

In the end I would like to be able to show what the average process is between two Process descriptions.

 

Any help would be appreciated.

 

 

3 Replies

  • This will give you date diff in a minute from the last row. There should be more conditions in filter clause like order no

    Last date = datediff(maxx(filter(table,table[track_id]<earlier(table[track_id])),table[track_date]),table[track_date],Minute)

     

    Check if this can help

     

    • erasm_w's avatar
      erasm_w
      Frequent Visitor

      Would it be possible to track the difference where I just use the track table?

      Every time a record is added it is linked to the Prim_ID_FK.

      I want to be able to show the description change from the first to the second record, then the second to the 3rd record and so on?

       

      Would I maybe need to index it?

       

      If there is only one record the Time Difference should be Today(), if there is another record then the difference between the first and and second instance, if a 3rd record then the difference between 3rd and 2nd and so on.

       

       The table will show:

       

      Prim_ID_FK (The record identifyer)   | Old Description (As per first instance) | New Description (As per new record added) | Time Diff                       1                                       Despactch                                              Test