Virtual Table of Weekdays between two date columns

Okay so give this a try.

  1. Create a New from Blank Query and call it MinDate
    image

  2. Create another called MaxDate
    image

  3. Change the Custom Column M code to

     let 
         LBound = if [FromDate] < MinDate then MinDate else [FromDate], 
         UBound = if [ToDate] > MaxDate then MaxDate else [ToDate] 
     in 
     List.Select( 
         List.Difference( 
             List.Dates( LBound, Number.From( UBound - LBound ) +1, Duration.From(1)), 
         List.Transform(#"Holiday Table"[Holiday Date], Date.From )), 
     each Date.DayOfWeek(_, 1) < 5 )
    

.
I hope this is helpful.

1 Like