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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors