cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
johankent30 Regular Visitor
Regular Visitor

Number of days between dates in M

How can I calculate the number of days between a date column formatted as "Date" and the current date in the query editor? For example, if my column has 8/5/2019 and the current date is 8/9/2019 then the custom column would read "4". Any thoughts? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Number of days between dates in M

Hello @johankent30 

In PowerQuery you can add a custom column and use this formula

Duration.Days (DateTime.Date(DateTime.LocalNow()) - [Your Date Column] )

In Dax you can add a calculated column and use this formula

DATEDIFF([Your Date Column],TODAY(),DAY)

View solution in original post

1 REPLY 1
Super User
Super User

Re: Number of days between dates in M

Hello @johankent30 

In PowerQuery you can add a custom column and use this formula

Duration.Days (DateTime.Date(DateTime.LocalNow()) - [Your Date Column] )

In Dax you can add a calculated column and use this formula

DATEDIFF([Your Date Column],TODAY(),DAY)

View solution in original post

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 144 members 1,699 guests
Please welcome our newest community members: