Date.StartOfWeek

This function returns the beginning of the week that includes the specified dateTime. The input dateTime can be a date, datetime, or datetimezone value.

Syntax

Date.StartOfWeek(dateTime as any, optional firstDayOfWeek as nullable number) as any

About

This function returns the beginning of the week that includes the specified dateTime. The input dateTime can be a date, datetime, or datetimezone value.

Explanation

Determine the beginning of the week for Tuesday, October 11th, 2011. To achieve this, the Power Query M function Date.StartOfWeek is utilized with the input of the specified date and time (#datetime(2011, 10, 11, 8, 10, 32)). The output, produced by the Power Query M function, correctly identifies the start of the week as Sunday, October 9th, 2011, represented by the date and time #datetime(2011, 10, 9, 0, 0, 0). In a similar manner, when selecting Monday as the beginning of the week, the Power Query M function Date.StartOfWeek is applied with the same input date and time (#datetime(2011, 10, 11, 8, 10, 32). The resulting output from the Power Query M function identifies Monday, October 10th, 2011 as the start of the week, which is denoted by the date and time #datetime(2011, 10, 10, 0, 0, 0).