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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
MF_BSC
New Member

How to calculate the through put time of a process for partial workdays only

I am trying to create a through put time for a process.   The output I am looking for is the hours in decimal format with one decimal place from the StartDate to FinishDate including partial days however excluding weekends.  I have gotten the report to output DateDiff in hours including partial days in correct format however it includes weekends, I have gotten NetworkDays to work in hours however it rounds up to the complete day.  I have gotten Datediff to list workdays only but not partial days in hours.  Is there a why to get the output in hours for partial workdays only?

MF_BSC_0-1739285836929.png

Lead time DateDIFF in DAX =
 DATEDIFF(Query1[StartDate],Query1[FinishDate],HOUR)+
     (DATEDIFF(Query1[StartDate],Query1[FinishDate],MINUTE)
     -DATEDIFF(Query1[StartDate],Query1[FinishDate],Hour)*60)/60
 vs
Lead time DateDIFF in DAX =
 DATEDIFF(Query1[StartDate],Query1[FinishDate],HOUR)+
     (DATEDIFF(Query1[StartDate],Query1[FinishDate],MINUTE)
     -DATEDIFF(Query1[StartDate],Query1[FinishDate],Hour)*60)/60
 

vs

Lead time Datediff test =
VAR _Datediff=
CALCULATE(
    SUM('Dates_2024'[Weekday]),
    DATESBETWEEN('Dates_2024'[Date],'Query1'[StartDate],'Query1'[FinishDate])
)-1
RETURN
IF(_Datediff<0,0,_Datediff)
1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @MF_BSC ,

 

Since you have start dates and end dates, the best approach to address your requirement is to use a disconnected calendar table to calculate the duration flexibly. With the disconnected table, you will be able to address the weekend etc., and time intelligence function in the calendar table.

 

Best regards,

View solution in original post

3 REPLIES 3
DataNinja777
Super User
Super User

Hi @MF_BSC ,

 

Since you have start dates and end dates, the best approach to address your requirement is to use a disconnected calendar table to calculate the duration flexibly. With the disconnected table, you will be able to address the weekend etc., and time intelligence function in the calendar table.

 

Best regards,

I found an you tube video that does just as you described.

Calculated Busines Hours using DAX (Working Hours in Power BI & Power Pivot-Excel) by Power GI

johnt75
Super User
Super User

You could combine the approaches you have tried. First work out the total difference including non-working days, then count the number of working days, multiply that by 24 and take it off the total difference.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.