cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Calculate difference between two dates power query

How do I calculate the difference between two dates in Power Query M code (not DAX)?  I'm looking for the number of days.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: Calculate difference between two dates power query

Hi @jshutters

 

you need to use the duration functions: https://docs.microsoft.com/en-us/powerquery-m/duration-days

 

=each Duration.Days([Date1] - [Date2])

 

 

 


 


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


Proud to be a Datanaut!  

View solution in original post

3 REPLIES 3
Highlighted
Solution Sage
Solution Sage

Re: Calculate difference between two dates power query

Hi @jshutters

 

you need to use the duration functions: https://docs.microsoft.com/en-us/powerquery-m/duration-days

 

=each Duration.Days([Date1] - [Date2])

 

 

 


 


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


Proud to be a Datanaut!  

View solution in original post

Highlighted
Advocate III
Advocate III

Re: Calculate difference between two dates power query

Hi, you can find the solution in this post.

 

http://blog.iwco.co/2018/12/07/numero-de-dias-entre-dos-fechas-power-query-m/

 

Regards

John Bocachica
Senior BI Consultant
Information Workers
http://www.iwco.co
Highlighted
Regular Visitor

Re: Calculate difference between two dates power query

In similar cases is better to use DAX or PowerQuery to this calculations?

Can anyone write advantages and disadventages this two ways of solving similar cases?

Helpful resources

Announcements
Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

August Community Highlights

Check out a full recap of the month!

Upcoming Events

Community Summit North America – Join Online!

Join this community-driven Power Platform digital event for unbiased support and problem-solving.

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Top Solution Authors