Date.DayOfWeekName is a function in the Power Query M language that returns the name of the day of the week for a provided date. An optional culture may also be provided.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Date.DayOfWeekName(
date as any,
optional culture as nullable text,
) as nullable text
Argument | Attribute | Description |
---|---|---|
date | ||
culture | optional | The culture argument enables the specification of a Culture code (e.g., “nl-NL” or “en-US”) to align transformations with local formatting conventions. If this argument is omitted, functions default to Culture.Current, which reflects the system’s regional settings. |
Description
Date.DayOfWeekName
provides the day of the week name for a specified date
. It can also accept an optional culture
argument for localization (e.g., “en-US”).
So what do we mean by culture
 here? Essentially, we’re referencing the standardized text representations of locales from the .NET framework. These culture codes perform a comparison in line with the rules of a given culture or locale. For an exhaustive list of culture codes, check the provided link.
Examples
The Date.DayOfWeekName
function works with date
, datetime
, and datetimezone
values.
Day of Week Name for a Date Value
When you apply the Date.DayOfWeekName
function to a date
value, it returns the name of the day of the week for that date. For example, to find the day of the week for June 15, 2024:
// Output: "Saturday"
Date.DayOfWeekName( #date( 2024, 6, 15 ) )
This expression returns “Saturday”, as June 15th, 2024 falls on a Saturday.
We can apply this to a table with a date column containing multiple date values. To get the name of the day of the week for each date, use Date.DayOfWeekName
as follows:
Using Culture Codes
When writing the above code, my machine language is on English. The output is therefore an English day of the week name. If you want to change that to a different language, you can make use of an optional culture code.
For instance, the Dutch word for “Saturday” is “zaterdag”. To return the Dutch value, you can pass the “nl-NL” culture code:
// Output: "Zaterdag"
Date.DayOfWeekName( #date( 2024, 6, 15 ), "nl-NL" )
When applying the Dutch culture code to a range of dates, this look as follows:
Day of Week Name for a DateTime Value
The function also supports datetime
values. To find the day of the week for a datetime value of June 16th, 2024, 12:00 AM:
// Output: "Sunday"
Date.DayOfWeekName( #datetime( 2024, 6, 16, 0, 0, 0 ) )
This expression returns “Sunday”, as June 16th, 2024 falls on a Sunday.
Day of Week Name for a DateTimeZone Value
Similarly, applying the function to a datetimezone
value returns the name of the day of the week for that datetimezone:
// Output: "Monday"
Date.DayOfWeekName( #datetimezone( 2024, 7, 15, 0, 0, 0, 1, 0 ) )
This expression returns “Monday”, as July 15th, 2024 falls on a Monday.
Related articles
Learn more about Date.DayOfWeekName in the following articles:
- Create Date Table with Dynamic Language in Power Query
Want your Date Table in Multiple Languages? This post explains how to make your calendar dynamic to support any language or culture. » 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
Related functions
Other functions related to Date.DayOfWeekName are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy