• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Calculate Time Span - difference in current row minus previous row.

I am using power BI desktop.

I wanted to get previous row value and then the difference current row - previous row value.

Timespan: What is the time difference in cutting receipts by a person (collected by)

I wanted to create new column Previous collected DTM where values of row preceding the current Collection DTM will be entered.

Then create another column where Collection DTM minus Previous collection DTM.

Data is sorted by combo:



upload_2018-5-29_23-24-55.png
 

Attachments

  • upload_2018-5-29_23-27-58.png
    upload_2018-5-29_23-27-58.png
    99.2 KB · Views: 1
Or as an alternative to referring to previous row, you can:
  1. add an index "starting from 1"
  2. add a second index "starting from 0"
  3. merge the table to itself: link index 1 to index 0
  4. Extract the new data
  5. do a (nested) if to calculate the difference between DTM and DTM.1 where collected by matches collected by.1
 
Back
Top