Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Date.DayOfWeekName: How to Use It

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Power Query's Date.DayOfWeekName function returns the name of the day of the week for a given date value. You use it in a custom column or when editing an existing step in the Power Query Editor, and it is available in Excel, Power BI, and other tools that host Power Query. The function takes a date, datetime, or datetimezone value and an optional culture code, and returns a text value such as "Monday" or "Mon" depending on the culture. It is a simple, reliable way to turn a date column into readable weekday labels without writing complex logic.

What You'll Need

  • A version of Excel, Power BI Desktop, or another host that includes the Power Query Editor. The function is part of the standard M library, so no add-in is required.
  • A table or query with at least one column that contains valid date values. Text that looks like a date will not work until it is converted to a date type.
  • Basic familiarity with opening the Power Query Editor and adding a custom column, or with editing the M code in the formula bar.

Step-by-Step

  1. Load your data into Power Query. In Excel, select your table and use Data > From Table/Range. In Power BI Desktop, use Home > Transform data to open the Power Query Editor with your data. Menu labels can differ slightly by version, device, or region, so look for the equivalent option if yours is worded differently.
  2. Confirm the date column is a real date type. Select the column header. If the icon in the header shows a calendar or a date symbol, it is already a date. If it shows "ABC" or a number, use Transform > Data Type and choose Date (or Date/Time, depending on your source). The function needs a date value, not text.
  3. Add a custom column. Go to Add Column > Custom Column. Give the new column a name, for example "Weekday Name".
  4. Enter the function in the formula box. Type Date.DayOfWeekName([YourDateColumn]), replacing YourDateColumn with the exact name of your date column, including brackets. For example, if the column is named OrderDate, the formula is Date.DayOfWeekName([OrderDate]). The function name and column reference are case-sensitive in M, so match the column name exactly.
  5. Optionally add a culture code. To return day names in a specific language, add a second argument as a text value, for example Date.DayOfWeekName([OrderDate], "en-US") for English (United States) or "de-DE" for German. Use a valid culture string; an invalid one causes an error.
  6. Click OK. Power Query adds the new column and shows the day names. If you see errors instead of names, check the next section.
  7. Check the result and change the type if needed. The new column is text by default, which is usually what you want. If you plan to sort by weekday, note that alphabetical order is not the same as Monday-to-Sunday order; you may need a separate numeric weekday column for sorting.
  8. Apply the changes. Use Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to load the result back into your workbook or model.

Common Mistakes

  • Passing text instead of a date. If the column is typed as text, the function returns an error. Convert the column to Date first, or wrap the value in Date.FromText only when you are sure of the format.
  • Misspelling the column name. M is case-sensitive. [OrderDate] and [orderdate] are different references, and a mismatch produces an error.
  • Forgetting the brackets. Column references must be wrapped in square brackets inside the custom column formula.
  • Using an invalid culture string. A culture code like "english" is not valid; use standard codes such as "en-US" or "fr-FR".
  • Expecting a fixed abbreviation. The function returns the full day name for most cultures. If you need "Mon" instead of "Monday", use Text.Start(Date.DayOfWeekName([OrderDate]), 3) as a separate step, and be aware this is a rough cut that may not suit every language.
  • Assuming the week starts on Monday. The function only returns the name; it does not change week-start settings. Week-start behavior is controlled elsewhere in your report or workbook.

Tips

  • Use the formula bar to review the generated step. The custom column appears as a Table.AddColumn step, and you can edit the formula directly there if you prefer.
  • If you need both the name and a sortable number, add two custom columns: one with Date.DayOfWeekName([OrderDate]) and one with Date.DayOfWeek([OrderDate]). The numeric version makes sorting predictable.
  • For a report that must show local language, set the culture argument explicitly rather than relying on the machine's regional settings, so the result is consistent for everyone who refreshes the file.
  • Keep the original date column. The weekday name is derived text and cannot be converted back to a full date on its own.
  • If your source dates include times, the function still works; it uses the date portion. You do not need to strip the time first.

Troubleshooting

If the new column shows Error in every row, the most likely cause is that the source column is not a date type. Select the original column, check its data type icon, and change it to Date. If only some rows error, those rows probably contain blank values, nulls, or invalid dates such as impossible calendar dates. Filter them out or replace them before applying the function.

If Power Query says the column name was not found, compare the name in the formula with the actual header exactly, including spaces and capitalization. Rename the column to something simple if needed. If the function itself is not recognized, confirm you are in the Power Query Editor and not in a regular worksheet formula; Date.DayOfWeekName is an M function, not an Excel worksheet function.

If the day names appear in an unexpected language, add or correct the culture argument. If the names are correct but sorting looks wrong, that is expected because text sorts alphabetically; add a numeric weekday column as described in the tips. If the query is slow on a very large table, the function itself is lightweight, so check for earlier steps that may be doing unnecessary work.

Frequently Asked Questions

Does Date.DayOfWeekName work in Excel and Power BI?

Yes. It is part of the Power Query M library used by both, and the steps are essentially the same in each host.

Can I get a short day name like "Mon"?

The function returns the full name for most cultures. To shorten it, wrap the result in Text.Start(..., 3), but check that the abbreviation suits your language and audience.

What happens if the date cell is blank?

A blank or null date produces an error in the new column. Filter or replace nulls before adding the custom column if your data contains them.

Can I choose the language of the day names?

Yes, by passing a culture code as the second argument, such as "en-GB" or "es-ES". Without it, the function uses the culture of the current environment.

Does the function change which day is treated as the start of the week?

No. It only returns the name of the day for the given date. Week-start settings are handled by the report or workbook, not by this function.

Can I use it on a datetime column?

Yes. A datetime value is accepted, and the function uses its date portion to determine the weekday name.