Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Complex Row Time Difference

Hi Team. Is there a way to reproduce this in Powerbi.?

 

This is the table I have to, in theory, I would like to subtract the time or duration between 2:36 PM and 2:50PM the same way I did in my excel file. Any idea on how to achieve this?

 

Thanks

9 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      That did not work. Sorry

       

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi Anonymous ,

     

    According to the table you provided, your purpose is to get the difference between the Time Out column and the next time value in Time IN column through power Bi. I did the following test: by defining two variables, var curindex is used to obtain the index value, var nextstratime is used to obtain the date value of the next row of the current row in the Start Time column, and finally the difference value is obtained by using the DATEDIFF function.

     

    Here is the sample pbix file.

     

    Best Regards,
    Henry

     

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

  • Hi,

    Try this calculated column formula

    =data[start time]-calculate(max(data[end time]),filter(data,data[start time]<earlier(data[start time])))

    Hope this helps.