Date.DayOfWeek is a function in the Power Query M language that returns a number from 0 to 6 indicating the day of the week of the provided value. The function accepts a parameter to specify which day should be considered the first day of the week.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Date.DayOfWeek( dateTime as any, optional firstDayOfWeek as nullable number, ) as nullable number
|dateTime||A date, datetime or datetimezone value.|
|firstDayOfWeek||optional||The Day.Type specifies the starting day of the week. If not explicitly specified, the function defaults to a culture-dependent day, aligning with regional week-start norms. It accepts values representing each day:|
– Day.Sunday (0) for Sunday,
– Day.Monday (1) for Monday,
– Day.Tuesday (2) for Tuesday,
– Day.Wednesday (3) for Wednesday,
– Day.Thursday (4) for Thursday,
– Day.Friday (5) for Friday,
– Day.Saturday (6) for Saturday.
Returns a number (from 0 to 6) indicating the day of the week of the provided
Get the day of the week represented by Monday, February 21st, 2011, treating Sunday as the first day of the week.
// Output: 1 Date.DayOfWeek( #date( 2011, 02, 21 ), Day.Sunday )
Get the day of the week represented by Monday, February 21st, 2011, treating Monday as the first day of the week.
// Output: 0 Date.DayOfWeek( #date( 2011, 02, 21 ), Day.Monday )
Learn more about Date.DayOfWeek in the following articles:
- Create ISO Week and ISO Year in Power Query M (ISO 8601)
Learn how to create ISO Week and Year numbers in Power Query for consistent weeks and fiscal calendars. Step-by-step tutorial included! » Read more
- Return Next Working Day in Power Query
Do you want to return the next working day in Power Query? There is no build in M-function for this, but this post shows how to create one yourself! » Read more
- Create Date Table or Calendar in Power Query M
Learn how to create a dynamic calendar table in Power Query’s M language. Build your custom columns and claim your free Date Table Script. » Read more
Other functions related to Date.DayOfWeek are: