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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
EVIJ
Regular Visitor

How to calculate the difference between rows instead of between columns

Hi,

 

I would like to calculate the datedifference between rows, and use a calculated column for this. Is this possible in Power BI?

 

For example:

row 1: 4-2-2020

row 2: 8-2-2020

row 3: 15-2-2020

etc.

 

How do I calculate the difference in days between 4-2-2020 and 8-2-2020, between 8-2-2020 and 15-2-2020?

Thank you.

 

Kind regards, Ellen

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@EVIJ , you can have new column like

diff =
dateduff(maxx(filter(table,[Date]<earlier([Date])),[Date]),[Date],day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @EVIJ 

 

If the above posts help, please kindly mark it as a answer to help others find it more quickly. thanks!

If not, please kindly elaborate more.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
ryan_mayu
Super User
Super User

@EVIJ 

you can try this

 

Column = 
VAR _max=MAXX(FILTER('Table','Table'[Column1]<EARLIER('Table'[Column1])),'Table'[Column1])

return DATEDIFF(_max,'Table'[Column1],DAY)

 

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you very much!! It works 🙂

amitchandak
Super User
Super User

@EVIJ , you can have new column like

diff =
dateduff(maxx(filter(table,[Date]<earlier([Date])),[Date]),[Date],day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you very much!! It works!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors