Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

help with rank and consecutive row time difference

I am having a tough time calculating my rank and time difference in seconds. here is my data. ID STATUS STEP STEPTIME 1234 changed walkin 3/29/2021 04:22:36 PM 1234 changed  signed...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    I think you can create a column to meet your needs.

     

    time between step =

    var _diff=DATEDIFF(

                        CALCULATE(MAX('Table'[STEPTIME]),FILTER('Table','Table'[STEPTIME]<EARLIER('Table'[STEPTIME]) && 'Table'[ID]=EARLIER('Table'[ID]))),

                           'Table'[STEPTIME],

                              SECOND)

    return IF(_diff=BLANK(),0,_diff)

     

    The effect is as shown:

    You saied that some milli second ones it is not calculating correctly. Because the min interval of DATEDIFF DAX is second. So there will be a little error.

      

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.