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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Workdays in formula

Right now i have this formula:  


= IF([Order placed] ="Yes",
IF(DATEDIFF([Order ready],[Order in],DAY)<0,0,DATEDIFF([Order in],[Order ready],DAY)),DATEDIFF([Order in],TODAY()+[Leadtime based on Complexity & training],DAY))

 

This fomula works, but counts the weekends and i need a formula that exlude the weekends (so only workdays). I already created a column in my calender that says if a day is a workday or weekend. See the picture below. So what i need in this formula is the date diffance in days between order in and order ready without weekends.

 

I hope someone understand my problem so he/she can help me

 

BramKruiswijk_0-1619081574011.png

 

 @amitchandak 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , There are common wat to get work day, you can replace one date with today

 

new measure

Work Day = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Min(Table[Start Date]),Max(Table[End Date])),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))

 

new column 

Work Day = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(Table[Start Date],Table[End Date]),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))

 

refer my video on this - https://www.youtube.com/watch?v=Qv4wT8_P-AA

 

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
Anonymous
Not applicable

Hi @amitchandak 

 

When i use this formula it says that "The start or end date in the Calendar function must not be empty". some of my rows in the start date are empty and i can't remove them out of the table, because it has important information. Is there a way using your formula without getting the this error message. Or a way to exclude those rows from the formula so i don't have to remove them?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.