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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
Albatross810
Regular Visitor

NETWORKDAYS dynamically filtering by dates and person

I want to calculate the working days between dates with varying holidays within a specified period. For example, I have a table that lists personal holidays:

 

PersonHolidays
Jane02-Feb-23
Jane03-Mar-23
Jane21-Jul-23
Michael01-Mar-23

 

And I have a table with jobs

                                          Jobs
JobPersonStartEndAvailability
Job 1Jane01-Jan04-Feb(Working days - holidays)
Job 2Michael10-Feb21-Apr 

 

I need the Availability column to include working days between those dates (or dates i select from a slicer, for example all of February), removing dates from the other table where the person has a holiday. Can anyone help me find a solution for this please?

1 ACCEPTED SOLUTION

@Albatross810 So like this?

Measure = 
    VAR __Person = MAX('Jobs'[Person])
    VAR __Result = NETWORKDAYS(MAX([Start]), MAX([End]), 1, SELECTCOLUMNS(FILTER('Holidays', [Person] = __Person),"__Holidays",[Holidays]))
RETURN
    __Result


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Albatross810 New way: NETWORKDAYS function (DAX) - DAX | Microsoft Learn

Old way: Net Work Days - Microsoft Power BI Community



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Been working with NETWORKDAYS all day, can't seem to solve this one. It doesn't sum multiple periods if I'm selecting several for example and won't let me use the holiday table dynamically by owner. But thank you for sharing.

@Albatross810 So like this?

Measure = 
    VAR __Person = MAX('Jobs'[Person])
    VAR __Result = NETWORKDAYS(MAX([Start]), MAX([End]), 1, SELECTCOLUMNS(FILTER('Holidays', [Person] = __Person),"__Holidays",[Holidays]))
RETURN
    __Result


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks so much, this worked well!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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