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

Business Days Calculation

Hello!

I know that in the past there wasn't really a DAX formula to create the difference in business days between two dates. I was just wondering if in recent updates, maybe there's an easy way to do it? 

 

Thanks,

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to your request, I did the following test: first add the Date column to slicer to get the two dates you want, then create a Result measure, VAR min and VAR max parameters to get the corresponding value of the selected date, and finally return result.

v-henryk-mstf_0-1609387297742.jpeg

Here is the sample .pbix file.

 

Best Regards,
Henry

 

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

amitchandak
Super User
Super User

@Anonymous , Still no out of the box formula

 

As a new column

 

Business days = SWITCH(TRUE(), NOT(ISBLANK(Employee[Start Date])) && NOT(ISBLANK(Employee[End Date])) , COUNTROWS(FILTER(
ADDCOLUMNS(CALENDAR([Start Date],[End Date]),"Weekday",WEEKDAY([Date])),[Weekday]
<6)))

 

Or Check the 2nd page of the attached file for measure

 

or refer to this blog - https://curbal.com/blog/glossary/networkdays-dax

littlemojopuppy
Community Champion
Community Champion

There is.  In your date table add a column for weekday (easily done using the WEEKDAY() function).  Including/excluding holidays is a little more difficult...

 

In all the measures you write you'll have to include a FILTER() for where weekday <> Sunday and <>Saturday (refer to the documentation for the weekday function for the exact values to use because it will depend on when what day of week you want to be first).

 

If you can provide some sample data I can write you a sample measure...

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.