Date.StartOfWeek is a Power Query M function that returns the start of the week containing the specified date(Time). Your input must be a date, datetime, or datetimezone value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Date.StartOfWeek( dateTime as any, optional firstDayOfWeek as nullable number, ) as any
Returns the start of the week that contains
dateTime. This function takes an optional
firstDayOfWeek, to set as the first day of the week for this relative calculation. The default value is
datetimezonevalue from which the last day of the week is calculated
firstDayOfWeek: [Optional] A Day.Type value representing the first day of the week. Possible values are Day.Sunday, Day.Monday, Day.Tuesday, Day.Wednesday, Day.Thursday, Day.Friday and Day.Saturday. The default value is
Find the start of the week for Tuesday, October 11th, 2011.
Date.StartOfWeek( #datetime( 2011, 10, 11, 8, 10, 32 ) ) /* Output: // Sunday, October 9th, 2011 #datetime( 2011, 10, 9, 0, 0, 0 ) */
Find the start of the week for Tuesday, October 11th, 2011, using Monday as the start of the week.
Date.StartOfWeek( #datetime( 2011, 10, 11, 8, 10, 32 ), Day.Monday ) /* Output: // Monday, October 10th, 2011 #datetime( 2011, 10, 10, 0, 0, 0 ) */
Learn more about Date.StartOfWeek in the following articles:
- 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.StartOfWeek are: