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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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.

August 2025 community update carousel

Fabric Community Update - August 2025

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