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
jdevalk77
Frequent Visitor

Calculating leadtimes considering officehours, weekends and holidays

Hi all, I can use some help on calculating leadtimes on different processes within our warehouse. Below you'll find a small example of my data:

DeliveryOrder1 Ready for orderpicking2 Start orderpicking3 Orderpicking completed4 Inhouse services completed5 Ready for packing6 Ready for shipment7 Is with carrier8 Delivered
Y78194JN75763-1-2022 08:093-1-2022 08:133-1-2022 08:31 3-1-2022 08:383-1-2022 17:354-1-2022 04:524-1-2022 10:24
Y78195JN34363-1-2022 08:143-1-2022 08:343-1-2022 09:107-1-2022 12:047-1-2022 13:4010-1-2022 09:22 10-1-2022 09:22
Y78244JN78803-1-2022 09:043-1-2022 09:103-1-2022 11:364-1-2022 08:324-1-2022 09:394-1-2022 17:405-1-2022 04:045-1-2022 13:34

 

Now I would like to calculate the leadtimes between multple touchpoint in the process considering officehours (between 8AM and 5PM) and weekends;
1 to 8
3 to 4
4 to 6

Therefore I found on this community a way to add a column with DAX (link) and that is working for just 1 calculation. But as soon as I add another column to calculate another process between 2 touchpoints, then I got a circular dependency error.

Anyone who could solve this by using magic? 😉

Thanks in advance.
BR, Jurgen

4 REPLIES 4
v-jialluo-msft
Community Support
Community Support

Hi @jdevalk77 ,

 

For information on how to avoid circular dependencies, you can refer to the following links:

Understanding circular dependencies in DAX - SQLBI
Avoiding circular dependency errors in DAX - SQLBI

 

Best Regards,

Gallen Luo

Great feedback thanks, but it take some experience to figure this out and find the right solution. Therefore I'll write a procedure in sql (source of the data) to perform the calculations. Anyway, thanks for your support so far.

Best regards,

Jurgen

amitchandak
Super User
Super User

@jdevalk77 , refer if this can help

https://exceleratorbi.com.au/calculating-business-hours-using-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for your quick response but it does work as soon as I add a second column with this DAX to calculate the time between 2 other timestamps. Then again I got the circular dependency error as I explained in my post. Would it be able to do it with a measure instead of adding a column?

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.