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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Jotad710
Microsoft Employee
Microsoft Employee

DateDiff without weekends

Hi team.

 

I'm using the DATEDIFF function to get the difference between two dates in hours (simple enough) like this 

 

DATEDIFF('Table1 (3)'[(Date1)].[Date],'(Date2)].[Date],HOUR)

 

I only need to exclude Saturday and Sunday. If the date is one of those days, it should be set to Monday 7am.

 

Can you help me on this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

This file has a few datediff. Use the one without weekend for your reference on page 2, measure = [Working Days]

https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Jotad710 ,

 

You can use WEEKDAY() function to get the weekday of the date.

Please refer to the measure below.

Measure = 
var sv = SELECTEDVALUE('Table'[date])
var swich = SWITCH(WEEKDAY(sv,2),6,FORMAT(sv+2,"MM/DD/YYYY")&" 7:00:00 AM",7,FORMAT(sv+1,"MM/DD/YYYY")&" 7:00:00 AM",sv)
return
DATEDIFF(swich,TODAY(),HOUR)

6.PNG 

BTW, you can refer to the following topics if you want to calculate datediff between two dates only count working days.

https://community.powerbi.com/t5/Desktop/DATEDIFF-Working-Days/m-p/130662.

https://community.powerbi.com/t5/Desktop/DATEDIFF-without-weekends/m-p/808620.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

I wrote a NETWORKDAYS measure quite a while ago:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

This file has a few datediff. Use the one without weekend for your reference on page 2, measure = [Working Days]

https://www.dropbox.com/s/y47ah38sr157l7t/Order_delivery_date_diff.pbix?dl=0

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors