Use Excel Power Query to Expand Employee Workdays into Daily Rows
Question details
Create one row per employee and working date from each person's monthly workday total.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- An employee table contains monthly workday totals that need to be assigned to dates in a selected month.
- Observed behavior
- The desired output lists each employee on the first N working dates of the month, excluding weekends and optionally holidays.
In Excel, create a table named EmployeeWorkdays with Employee and Workdays columns. Enter a nonnegative whole-number total for each employee, and confirm that assigning dates from the start of the month suits your schedule.
Generate and expand working dates in Power Query
Use an M query to assign the first available weekdays in the selected month to each employee.
The query defaults to the current month and assigns the same first N working dates to each employee. It does not distribute workdays evenly across the month.
In Excel, select Data > Get Data > From Other Sources > Blank Query, then open Home > Advanced Editor.
Replace the editor contents with the following code and select Done: let MonthStart = Date.StartOfMonth(Date.From(DateTime.LocalNow())), MonthEnd = Date.EndOfMonth(MonthStart), AllDates = List.Dates(MonthStart, Duration.Days(MonthEnd - MonthStart) + 1, #duration(1, 0, 0, 0)), Holidays = {}, WorkingDates = List.Select(AllDates, each Date.DayOfWeek(_, Day.Monday) < 5 and not List.Contains(Holidays, _)), Source = Excel.CurrentWorkbook(){[Name="EmployeeWorkdays"]}[Content], AddedDates = Table.AddColumn(Source, "Work Date", each List.FirstN(WorkingDates, Number.From([Workdays])), type list), ExpandedDates = Table.ExpandListColumn(AddedDates, "Work Date"), Result = Table.TransformColumnTypes(ExpandedDates, {{"Work Date", type date}}) in Result
To use a fixed month, replace the MonthStart expression in Advanced Editor with a date such as #date(2026, 7, 1).
Create an Excel table named Holidays with a Date column, then replace Holidays = {} with Holidays = List.Transform(Excel.CurrentWorkbook(){[Name="Holidays"]}[Content][Date], each Date.From(_)).
Check the employee and Work Date rows in the preview, then select Home > Close & Load to return the results to Excel.

Review Employee Workday Tables in WPS Spreadsheet
WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface. Open compatible Excel files to review and edit employee workday tables as you migrate; WPS does not fix Excel Power Query issues, and query refresh compatibility is not guaranteed.

Frequently Asked Questions
How does the query exclude weekends?
The List.Select step uses Date.DayOfWeek with Day.Monday and keeps values below 5, which correspond to Monday through Friday.
How can I use a different month?
Open the query in Power Query Editor, select Home > Advanced Editor, and replace the MonthStart expression with a date such as #date(2026, 7, 1).
Can I exclude public holidays as well?
Yes. Create an Excel table named Holidays with a Date column and replace the empty Holidays list in the query with the table-based expression shown in the solution.
What happens if an employee has more workdays than available dates?
List.FirstN returns only the available working dates. Check totals against the month's weekday count after holidays are excluded.
How do I update the output after changing the employee table?
In Excel, select Data > Refresh All to rerun the query. The default month also updates based on the local current date when the query refreshes.




