Forum Discussion

Magomed's avatar
Magomed
Helper I
7 years ago
Solved

DATEDIFF between Rows

Hello,     I have a question about how to calculate datediff between rows. I have dataset like below:    Trackingtocken createdon 1 01.08.2018 08:00 1 01.08.2018 08:01 1 01.08.201...
  • v-lili6-msft's avatar
    7 years ago

    HI, Magomed

    After my test, you could do these follow my steps as below:

    Step1:

    Add a group rank column 

    group rank = RANKX(FILTER(Table1,Table1[Trackingtocken]=EARLIER(Table1[Trackingtocken])),Table1[createdon],,ASC)

    Step2:

    Use EARLIER Function add a datediff column

    Datediff = DATEDIFF(CALCULATE(MAX(Table1[createdon]),FILTER(Table1,Table1[Trackingtocken]=EARLIER(Table1[Trackingtocken])&&Table1[group rank]=EARLIER(Table1[group rank])-1)),Table1[createdon],MINUTE)

    Result:

    here is pbix, please try it.

    https://www.dropbox.com/s/0v0qnnue9j1hvyx/DATEDIFF%20between%20Rows.pbix?dl=0

     

    Best Regards,

    Lin