Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Gillard_2
Frequent Visitor

DateDiff Between Rows

Hi all,

I have a data set that is pulling from a sharepoint list. I have succesfuul manage to not only pull in the records but all the version history too, as as individual rows.

What i am trying to achieve is a duration column which shows the length of time between each version for all records.

I have a unique ID column which distinguishes between the sharepoint items, and i have the version column.

So i need something like:

DateDiff(ModifiedDate,Previous versions Modified Date for this specific record) The red bit is the bit i am struggling with.

 

They wont always be in the nice organised order you see below and there will be a big mix of Unique Record IDs. But they will always increase in increments of 1.

 

Hope that makes sense.

 

Gillard_2_0-1625064709956.png

Gillard_2_1-1625064764353.png

 

 

Any help would be great thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Gillard_2 ,

 

You could use EARLIER() function.

diff = 
var _previous = calculate(max('table'[modified date]),filter('table','table'[recordid] = earlier('table'[recordid])&&'table'[version] = earlier('table'[version])-1))
return
datediff('table'[modified date],_previous,day)

 

Best regards,

Jay

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Gillard_2 ,

 

You could use EARLIER() function.

diff = 
var _previous = calculate(max('table'[modified date]),filter('table','table'[recordid] = earlier('table'[recordid])&&'table'[version] = earlier('table'[version])-1))
return
datediff('table'[modified date],_previous,day)

 

Best regards,

Jay

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.