Smart Systems for Home

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

Power Query Date.MonthName Function: Step-by-Step Guide

· 5 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

The Date.MonthName function in Power Query returns the full name of the month (e.g., "March") for a given date—no external tools or setup are required.

What You'll Need

  • Microsoft Excel (2016 or later) or Power BI Desktop (or the service), with Power Query enabled
  • A table or query containing at least one date column (e.g., OrderDate, StartDate)
  • Basic familiarity with Power Query Editor (opening it, identifying columns)

Step-by-Step

  1. Open Power Query Editor: In Excel, go to the Data tab > Get Data > Launch Power Query Editor (or select Transform Data if already in a query). In Power BI, click Transform data in the Home tab.
  2. Select your date column: In the Power Query Editor pane, click the header of the column containing dates (e.g., OrderDate). Ensure the data type is set to Date or DateTime—not text. If it’s text, convert it first by right-clicking the column > Change Type > Date or DateTime.
  3. Add a custom column: Go to the Add Column tab > click Custom Column. A dialog box appears.
  4. Enter the formula: In the Custom column name field, type a descriptive name like MonthName. In the Custom column formula box, type: Date.MonthName([OrderDate]) (replace OrderDate with your actual column name). Use brackets around the column name.
  5. Confirm and apply: Click OK. A new column appears with full month names (e.g., "January", "February"). If the column shows errors, check for blank or non-date values in the source column.
  6. Optional: Sort by month order: Click the dropdown arrow on the new MonthName column > Sort A to Z. This sorts alphabetically (January → December). For chronological order (January → December), right-click the column > Sort by Column > select your original date column, then choose Sort A to Z.

Common Mistakes

  • Using text instead of date columns: If the input column is formatted as text (e.g., "2023-03-15"), Date.MonthName returns an error. Always ensure the column type is Date or DateTime.
  • Missing brackets around the column name: Writing Date.MonthName(OrderDate) instead of Date.MonthName([OrderDate]) causes a Name error. Column references in Power Query formulas require square brackets.
  • Incorrect date format in source data: Dates like "15/03/2023" may be misinterpreted depending on regional settings (e.g., day/month vs. month/day). Use Change Type > Date to standardize, or use Date.From first to parse reliably.
  • Assuming it returns a number: Date.MonthName returns text (e.g., "March")—not a number like 3. Use Date.Month if you need the month number.

Tips

  • For abbreviations (e.g., "Mar"), combine with Text.Start : .
  • To handle blank dates, wrap in try and otherwise : .
  • For multilingual support, use to force English, or replace "en-US" with another culture code like "fr-FR" for French. By default, it uses the system locale.
  • When building reports, add a numeric month column (e.g., ) alongside MonthName for reliable sorting. Alphabetical sorting of month names can cause issues (e.g., "April" before "February").
  • If your date column includes time components (e.g., 3/15/2023 2:30 PM), Date.MonthName still works—but only the date portion is used. For consistency, you can extract the date first with Date.From([DateTimeColumn]) before applying Date.MonthName.

Troubleshooting

If Date.MonthName returns an error or unexpected result, follow these steps:

  1. Check for nulls or blanks: Filter your date column to show blanks or errors. Date.MonthName(null) returns null, which may appear as error if the column is non-nullable. Use try ... otherwise to replace errors with a default value.
  2. Verify data type : Right-click the date column > Data Type > ensure it shows Date or DateTime . If it shows Any or Text , click Date to convert.
  3. Test with a known date: Create a new custom column with Date.MonthName(#date(2024, 7, 15))—this should return "July". If it does, the issue is with your source column, not the function.
  4. Check regional settings: In Excel, go to File > Options > Advanced > scroll to When calculating this workbook > Use 1904 date system (uncheck unless needed). In Power BI, go to File > Options and settings > Options > Current Workspace > Regional Settings and confirm the locale. Mismatched locales can affect date parsing.
  5. Review formula syntax : Common typos include: missing brackets (e.g., ), extra spaces (e.g., Date. MonthName ), or incorrect capitalization. Power Query is case-insensitive for functions but strict about parentheses and commas.

Frequently Asked Questions

Does Date.MonthName work with null or empty values?

Yes, but it returns null for null inputs. If your query expects text, this can cause errors downstream. Use to handle blanks gracefully.

Can I use Date.MonthName in DAX or only in Power Query?

Date.MonthName is a Power Query (M language) function and cannot be used directly in DAX (used in Power BI data model or Excel Power Pivot). In DAX, use for the full month name.

Why does my month name appear in a different language?

The function uses your system’s locale by default. To force English, specify the culture: . Replace "en-US" with another code (e.g., "de-DE") for other languages, provided the locale is installed on your system.

How is Date.MonthName different from Date.Month?

Date.Month returns a number (1–12), while Date.MonthName returns the full month name as text (e.g., "December"). Use Date.Month for numeric grouping, and Date.MonthName for readable labels in reports.

Can I get a 3-letter abbreviation like "Jan" directly?

No— Date.MonthName only returns full names. To abbreviate, wrap it: . This extracts the first three characters (e.g., "Jan", "Feb").

Does this work in Power BI Service (online)?

Yes. Steps are identical in Power BI Desktop and the Power BI Service. After editing in Power BI Desktop, publish the report to the service, and the Date.MonthName column will appear in the dataset. Ensure the dataflow or dataset is refreshed if source data changes.