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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How can you create a column that shows the days between Dates?

Hello all,

 

How can I create a column that shows me how many days have passed between diffrent dates?

DatesDay Between
Monday, 3. Aug 2020 
Friday, 31. Jul 20203
Thursday, 30. Jul 20201
Monday, 20. Jul 202010
Tuesday, 14. Jul 20206

 

Thank you in advance for your time.

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Incase you want a measure

 

Dates B = 
var a = MAX(Table1[Date])
var _prevdate = CALCULATE(MAX(Table1[Date]) , FILTER(ALL(Table1),Table1[Date] < a))
RETURN
DATEDIFF(_prevdate,a,DAY)

 

1.jpg

 

Incase you want a Column

 

Prev Date = 
var _prevdate = CALCULATE(MAX(Table1[Date]) , FILTER(Table1,Table1[Date] < EARLIER(Table1[Date])))
RETURN
DATEDIFF(_prevdate,Table1[Date],DAY)

 

 

 

 

2.JPG

 

 

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

 

 

amitchandak
Super User
Super User

@Anonymous , try a new column like

datediff([dates], minx(filter(table, [dates]>earlier[dates]),[dates]),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
HotChilli
Super User
Super User

ColumnB = VAR _theDate = TableD[Dates]
VAR _1higherDate = MINX(FILTER(TableD, TableD[Dates] > _theDate), TableD[Dates] )
RETURN
   DATEDIFF( _theDate, _1higherDate,  DAY)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.