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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
mitchpj75
Helper I
Helper I

Days between 2 date columns to be calculated but also exclude saturdays and sundays

Requirement - I am trying to calculate the number of days between 2 date columns ('Date of referral' and 'Date of initial attempted contact) , excluding saturday and sunday.  Then convert the total days to hrs as I need to show whether the time between the 2 dates is <= or => 24 hrs.

 

Method:

1) In Power Query Editor, on table called 'Case atts and case atts values merged', I have a custom column called 'Date of intial attempted contact minus date of referral - KPI 3'. 

The custom query is = [Date of initial attempted contact]-[Date of referral] fields.

This gives me the days between dates.

 

I also have a date table (called 'Date") which sets out a column called 'IsWorkingDay' showing Saturday and Sunday as False (all other days are True).

 

How do I use the date table to exlude saturday and sunday from my custom query of [Date of initial attempted contact]-[Date of referral] days between dates??

 

Really looking for some help as struggling!

 

Thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mitchpj75 , refer to the 2nd page - working day on the attached file after the signature of the blog

https://www.sqlbi.com/articles/counting-working-days-in-dax/

https://curbal.com/blog/glossary/networkdays-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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@mitchpj75 , refer to the 2nd page - working day on the attached file after the signature of the blog

https://www.sqlbi.com/articles/counting-working-days-in-dax/

https://curbal.com/blog/glossary/networkdays-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

Thank you for the response! I did look at these as the solution but I still struggled however through further searching I was able to do what I need with the following:

 

Watched this first - https://www.youtube.com/watch?v=kRACuS4eKWA

Then used the code here to setup the UI and it worked - https://www.thebiccountant.com/2020/02/20/date-networkdays-function-for-power-query-and-power-bi/

 

All seems overly complicated to work out the number of working days between dates but the solutions worked.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.