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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Power BI Desktop August 2020 Update

Power BI Desktop August 2020 Update

We have great updates this month! Click the link for the video with more info.

Top Solution Authors
Top Kudoed Authors