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.
Hello,
I currently am using this "Hours" formula which counts the amount of hours an employee has worked in one day. I now need to adjust this formula to create a measure calculating the total amount of hours an employee has worked in one week. How can I adjust this formula? I've tried datesinperiod, dateadd, & weeknum -1 additions to this formula with no luck due to the way this function is built. Thank you!
Hours =
var startpack = MIN('public packs_per_day'[Packed At Time CST])
var startpick = MIN('public picks_per_day'[Picked At Time CST])
var startinventory = MIN('public inventory_change_reasons'[Inventory Changed at Time CST])
var startday = MIN('Clock In/Out'[Clock In Time])
var endpack = MAX('public packs_per_day'[Packed At Time CST])
var endpick = MAX('public picks_per_day'[Picked At Time CST])
var endinventory = MAX('public inventory_change_reasons'[Inventory Changed at Time CST])
var endday = MAX('Clock In/Out'[Actual Clock Out Time])
var starttab = {(startpick),(startpack),(startinventory),(startday)}
var endtab = {(endpick),(endpack),(endinventory),(endday)}
return
IF(
OR(HOUR(MAXX(endtab,[Value]))=0,HOUR(MINX(starttab,[Value]))=0),
0,
IF(
HOUR(MAXX(endtab,[Value]))=
HOUR(MINX(starttab,[Value])),
1,
HOUR(MAXX(endtab,[Value]))-
HOUR(MINX(starttab,[Value]))-1.5
)
)
Hi Ryan - Here is some sample data where I have given the hours output of each min/max function:
MIN('public packs_per_day'[Packed At Time CST]) = 6:00am
MIN('public picks_per_day'[Picked At Time CST]) = 6:05am
MIN('public inventory_change_reasons'[Inventory Changed at Time CST]) = 8:00am
MIN('Clock In/Out'[Clock In Time]) = 6:10am
MAX('public packs_per_day'[Packed At Time CST]) = 5:00pm
MAX('public picks_per_day'[Picked At Time CST]) = 4:30pm
MAX('public inventory_change_reasons'[Inventory Changed at Time CST]) = 5:30pm
MAX('Clock In/Out'[Actual Clock Out Time]) = 6:00pm
Then the rest of the function would take the min of all "start" variables and the max of all "end" variables (less 1.5 hours). This is to capture total hours worked in a single day based on these times. The result of the formula from this same data would be 10.5 hours. This is because 6am to 6pm is 12 hours total with 1.5 hours subtracted for expected breaks. Please let me know if you can assist me in creating a function like this, but based on an entire week's worth of hours. Thank you!
pls provide some sample data which is your raw data, not the measure you used. That will help to provide the solution for you
Proud to be a Super User!
could you pls provide the sample data and expected output?
Proud to be a Super User!