Forum Discussion

Albatross810's avatar
Albatross810
Regular Visitor
3 years ago
Solved

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?

  • Greg_Deckler's avatar
    Greg_Deckler
    3 years ago

    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

4 Replies