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
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
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors