Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.