Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I've been struggling with calculating processing time in workdays and processing time in workhours.
i've used the following function to calculate the DateDiff in workdays between 2 dates:
= (InitialDate as date, FinalDate as date ) as number =>
let
DaysBetweenDates = Duration.Days(FinalDate-InitialDate),
DaysList = List.Dates(List.Min({InitialDate,FinalDate}),Number.Abs(DaysBetweenDates)+1, Duration.From(1)),
WeekDaysList = List.Select(DaysList, each (Date.DayOfWeek(_, Day.Monday) < 5) ),
WorkingDays = (if DaysBetweenDates < 0 then -1 else 1) * List.Count(WeekDaysList)
in
WorkingDays
now this works fine, but it'll give a processing time of 1 day, for a ticket that has been created AND closed on the same day. In those cases it's simple; closureTime - creationTime. for tickets that span multiple days this doens't work tho. Since our company's opening times are from 08:00:00 to 17:00:00, i tried to calculate the difference between the creationTime and 17:00:00 (on the creationday), and add that to the difference of 08:00:00 and the closureTime (on the closingDay) and add that SUM to the whole workdays that it had already calculated. This works fine, but i noticed some tickets were being created/closed outside of workinghours, so subtracting them gives negative values. How do i remedy this? This is what i have so far regarding the timediff:
values:
creationDate2: 13-4-2022 21:01:25
closureDate2: 14-4-2022 08:52:00
weekDayDiff function gives: 2 days
TestDate (the code above): -0,07 workingdays (which is not correct)
Sorry for the long question...
Hi @Icey,
creationTime is a derivative of creationDate2, they have the same function in this case. I did do some other calculations where i couldn't get it to work with just creationDate2, and since i'm an utter noob in powerBI, deriving the timevalue from creationDate2 to work with it separately looked like a good idea :0.
Hi @Anonymous ,
There are both "creationDate2" and "creationTime", and you both use TIMEVALUE for them. What's the difference between them?
Could you share more details about your data structure?
Reference:
How to Get Your Question Answered Quickly - Microsoft Power BI Community
How to provide sample data in the Power BI Forum - Microsoft Power BI Community
Best Regards,
Icey
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.