Home » Power Query M Functions » Date.DayOfWeekName – Power Query M Function

Date.DayOfWeekName – Power Query M Function

Week name by culture

The Date.DayOfWeekName function in Power Query’s M language is used to returns the name of the day of the week from a date value.

Syntax:

Date.DayOfWeekName(date as any, optional culture as nullable text)

Let’s get stated-

Download the sample Dataset from below link-

In this example you will see “How to get the day of week name from the “Order Date” column?”

Follow the steps below-

Step-1: Go to the Home Tab of Power BI Desktop and Open Power Query Editor  window by selecting “Transform data“.

Step-2: In the Queries pane,  select the “Orders” table.



Step-3: In the Home tab, click on “Add Column”  and choose “Custom Column“.

Select Query in Query Editor

Select Query in Query Editor

Step-4: In the “Custom Column” dialog box, provide a name for the new column.

Step-5: After that enter the following expression, and click on “Ok” to create the new column.

Date.DayOfWeekName([Order Date])

After applying the changes, you will see a new column in the table named “DayOfWeekName” with the names of the days of the week corresponding to the “Order Date” values.

Day of week from date column

Day of week from date column

Date.DayOfWeekName with Culture-

Example-

Date.DayOfWeekName([Order Date], “en-US”)

In above example second argument is optional but you can pass the culture codes there and this parameter allows you to specify the culture or locale for which you want to retrieve the day of the week name.



"en-US" specifies the culture as “en-US” (English – United States).

Here are a few examples of culture codes for different cultures:

“en-US” – English (United States)
“hi-IN” represents Hindi (India)
“en-GB” – English (United Kingdom)
“es-ES” – Spanish (Spain)
“fr-FR” – French (France)
“de-DE” – German (Germany)
“it-IT” – Italian (Italy)
“ja-JP” – Japanese (Japan)
“ko-KR” – Korean (South Korea)
“pt-BR” – Portuguese (Brazil)
“ru-RU” – Russian (Russia)

Hope you enjoyed the post. Refer more M functions Tutorials

Leave a Reply