Date.DayOfWeek
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 number between 0 and 6 representing the day of the week from a DateTime value.
Date.DayOfWeek(dateTime as datetime, optional firstDay as nullable number) as nullable number
| Argument | Description |
|---|---|
| dateTime | The DateTime to check against. |
| optional firstDay | A Day type representing the first day of the week for this calculation. The default is Day.Sunday. |
Enum values
Day.Sunday = 0;
Day.Monday = 1;
Day.Tuesday = 2;
Day.Wednesday = 3;
Day.Thursday = 4;
Day.Friday = 5;
Day.Saturday = 6;
Date.DayOfWeek(DateTime.FromText("2011-02-21")) equals 2
Date.DayOfWeek(DateTime.FromText("2011-02-21"), Day.Monday) equals 1
Show: