Power Query Date.MonthName Function: Step-by-Step Guide
In this article
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
- Open Power Query Editor: In Excel, go to the
Datatab >Get Data>Launch Power Query Editor(or selectTransform Dataif already in a query). In Power BI, clickTransform datain the Home tab. - 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 toDateorDateTime—not text. If it’s text, convert it first by right-clicking the column >Change Type>DateorDateTime. - Add a custom column: Go to the
Add Columntab > clickCustom Column. A dialog box appears. - Enter the formula: In the
Custom column namefield, type a descriptive name likeMonthName. In theCustom column formulabox, type:Date.MonthName([OrderDate])(replaceOrderDatewith your actual column name). Use brackets around the column name. - 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. - Optional: Sort by month order: Click the dropdown arrow on the new
MonthNamecolumn >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 chooseSort 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.MonthNamereturns an error. Always ensure the column type isDateorDateTime. - Missing brackets around the column name: Writing
Date.MonthName(OrderDate)instead ofDate.MonthName([OrderDate])causes aNameerror. 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>Dateto standardize, or useDate.Fromfirst to parse reliably. - Assuming it returns a number:
Date.MonthNamereturns text (e.g., "March")—not a number like 3. UseDate.Monthif 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.MonthNamestill works—but only the date portion is used. For consistency, you can extract the date first withDate.From([DateTimeColumn])before applyingDate.MonthName.
Troubleshooting
If Date.MonthName returns an error or unexpected result, follow these steps:
- Check for nulls or blanks: Filter your date column to show blanks or errors.
Date.MonthName(null)returnsnull, which may appear aserrorif the column is non-nullable. Usetry ... otherwiseto replace errors with a default value. - 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.
- 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. - Check regional settings: In Excel, go to
File>Options>Advanced> scroll toWhen calculating this workbook>Use 1904 date system(uncheck unless needed). In Power BI, go toFile>Options and settings>Options>Current Workspace>Regional Settingsand confirm the locale. Mismatched locales can affect date parsing. - 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.