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
JPScotland
Helper I
Helper I

Calculate time duration between 2 dates and times including partial days

Hi, 

 

I am looking to do exactly what is in this post below except instead out outputting the number of complete days, I need partial days also.   

 

https://community.powerbi.com/t5/Desktop/DATEDIFF-Working-Days/td-p/130662

 

i.e.

Start Date/Time = 14/04/2022 07:45

End Date = 14/04/2022 13:45

RESULT = 0.25

 

Start Date/Time = 14/04/2022 08:33

End Date = 20/04/2022 14:07

RESULT = 6.23

 

You can get this by a simple subtraction calc but I need to filter out working days which wont work with the suctraction.  The only way I can really think of working it out is to possibly caculate it all in minutes and filter out days by subtracting 1440 minutes for each day that is not a workday. 

 

Cheers,

JP

 

 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @JPScotland ,

You can refer to my answer to this case, which is calculated to the hour.

vluwangmsft_0-1651462047021.png

And you could use the following to create date table with minute:

 

Table.FromColumns({List.DateTimes(#datetime(2017,1,1,0,0,0),365*1440,#duration(0,0,1,0))}, type table[DateTime=datetime])

 

vluwangmsft_1-1651462417422.png

 

 

 

The overall idea is to eliminate the total number of rows for the weekend between the two time differences, and then count by 60 (minutes) divided by 24 (hours).

 

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


Best Regards

Lucien

View solution in original post

2 REPLIES 2
JPScotland
Helper I
Helper I

Thanks mate.  Appreciate you taking the time to reply 🙂

v-luwang-msft
Community Support
Community Support

Hi @JPScotland ,

You can refer to my answer to this case, which is calculated to the hour.

vluwangmsft_0-1651462047021.png

And you could use the following to create date table with minute:

 

Table.FromColumns({List.DateTimes(#datetime(2017,1,1,0,0,0),365*1440,#duration(0,0,1,0))}, type table[DateTime=datetime])

 

vluwangmsft_1-1651462417422.png

 

 

 

The overall idea is to eliminate the total number of rows for the weekend between the two time differences, and then count by 60 (minutes) divided by 24 (hours).

 

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


Best Regards

Lucien

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.

Top Solution Authors