Power Query- Power Platform Data Flow- Counts Days within date range- [Date Column] - Today's date- remove weekends and Holidays

Create a dynamic date range with today's date being the end date. Counts all the "Business" days with no weekends or holidays.laugh

 

let

    StartDate = DateTime.Date([Your Start Date Column Name]),

    EndDate = DateTime.Date(DateTime.LocalNow()),

 

    Holidays = {

        #date(2025, 1, 1),

        #date(2025, 5, 26),

        #date(2025, 7, 4),

        #date(2025, 9, 1),

        #date(2025, 11, 27),

        #date(2025, 12, 25)

    },

 

    DateList = List.Dates(

        StartDate,

        Duration.Days(EndDate - StartDate) + 1,

        #duration(1,0,0,0)

    ),

 

    BusinessDays = List.Select(

        DateList,

        each Date.DayOfWeek(_, Day.Monday) < 5

            and not List.Contains(Holidays, _)

    ),

 

    BusinessDayCount = List.Count(BusinessDays)

in

    BusinessDayCount

Blog Type: