Date.StartOfWeek

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns a DateTime value representing the start of the week.

Date.StartOfWeek(dateTime as nullable datetime, optional firstDay as nullable number) as nullable datetime  

ArgumentDescription
dateTimeThe DateTime to check against.
optional firstDayAn optional argument to set the first day of the week.

Enum Values

  • Day.Sunday = 0;

  • Day.Monday = 1;

  • Day.Tuesday = 2;

  • Day.Wednesday = 3;

  • Day.Thursday = 4;

  • Day.Friday = 5;

  • Day.Saturday = 6;

  • The date and time portions are reset to their initial values for the week.

  • The timezone information is persisted.

dateTime = DateTimeZone.FromText("2011-02-24T12:30:00-08:00");   
Date.StartOfWeek(dateTime, Day.Monday) equals 2011-02-21T00:00:00-08:00  

Show: