How to Order Months in Power BI
If you've ever dragged month names into a Power BI visual, you've probably seen your chart display months in a peculiar order: April, August, December, February... It’s a classic "welcome to Power BI" moment. Fortunately, fixing this is simple once you understand why it's happening. This tutorial will walk you through exactly how to get your months to display in the correct chronological order, from January to December.
Why Power BI Sorts Months Alphabetically
The root of the problem is straightforward: Power BI sees a column containing "January," "February," and "March" as simple text values. By default, it sorts text alphabetically. So, "April" comes before "August," and "August" comes before "December," exactly as it should for text. It has no built-in, magical understanding that "February" should follow "January."
To fix this, we need to provide that context. The solution involves creating a second, hidden column that contains the numerical order of the months (e.g., 1 for January, 2 for February). Then, we tell Power BI to sort our month name column based on the order of our new month number column.
There are two primary ways to create this helper column: in the Power Query Editor or with DAX formulas. We'll cover both.
Method 1: Create a Sorting Column in Power Query
Using Power Query is often the best practice for this type of data preparation, as it happens early in the data loading process and keeps your model clean. This method assumes you have a column with a full date in your dataset (e.g., "1/15/2024").
Step 1: Open the Power Query Editor
First, you need to open Power Query. From the main Power BI Desktop window, go to the Home tab on the ribbon and click on Transform data. This will launch the Power Query Editor in a new window.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 2: Add a Month Name Column
Once inside Power Query, find your table in the left-hand pane and select the column that contains your dates. With the date column selected, navigate to the Add Column tab on the ribbon.
From here, follow these clicks:
- Click the Date dropdown.
- Hover over Month.
- Select Name of Month.
Power Query will instantly add a new column to your table with the full month name (e.g., "January") for each corresponding date. You can rename this column if you like by double-clicking the header.
Step 3: Add a Month Number Column
This is the crucial step for creating our sorting logic. With your date column still selected, head back to the Add Column tab.
Follow a similar path:
- Click the Date dropdown.
- Hover over Month.
- This time, select Month (it’s just the single word, standing for the month number).
You’ll now have another new column containing numbers 1-12. This is the column we'll use to define the correct sort order.
Step 4: Close & Apply
You now have both the "Month Name" and "Month Number" columns in your table. To save these changes and return to the main Power BI window, click the Close & Apply button in the upper-left corner of the Power Query Editor.
Method 2: Create a Sorting Column with DAX Formulas
If you prefer to work within the main Power BI interface or if your data is already loaded, you can achieve the same result by creating calculated columns using DAX (Data Analysis Expressions).
Step 1: Navigate to the Data View
In Power BI Desktop, look at the pane on the far left. Click the icon that looks like a table to switch to the Data View. This is where you can see the raw data in your tables.
Step 2: Create the Month Name Column
Select the table you want to modify from the Fields pane on the right. In the ribbon at the top, the Table tools menu will appear. Click New column.
A formula bar will appear above your data. Enter the following DAX formula and press enter:
Month Name = FORMAT([YourDateColumn], "MMMM")Be sure to replace [YourDateColumn] with the actual name of your date column. The "MMMM" part of the formula tells DAX to extract the full name of the month.
Tip: If you wanted the three-letter abbreviation (e.g., "Jan"), you would use "MMM" instead.
Step 3: Create the Month Number Column
We’ll repeat the process to get our numeric month column. Click New column again from the Table tools ribbon.
In the formula bar, enter this simpler DAX formula:
Month Number = MONTH([YourDateColumn])Again, replace [YourDateColumn] with your date column’s name. This formula extracts the number of the month (1-12) from the date. You've now successfully created both columns needed to fix the sort order.
The Final Step: Applying the 'Sort by Column' Feature
Whether you used Power Query or DAX, the final step is the same. This is where we explicitly tell Power BI how to handle the sorting for your month name column.
Important: All steps below happen in the Data View on the main Power BI screen.
- Select the Month Name Column: In the Data View, find the column with your month names (e.g., "Month Name," or whatever you named it). Click on the header of this column to select it. Do not select the month number column. You must select the column that you want to sort.
- Find the 'Sort by Column' Tool: With the month name column highlighted, look at the main ribbon at the top. A contextual tab called Column tools will be visible. Click on the Sort by column icon.
- Choose Your Sorting Column: A dropdown menu will appear showing all the other columns in your table. Select the numeric month column you created earlier (e.g., "Month Number").
That's it! Nothing will visually change in the Data View, but you have successfully created a relationship that tells Power BI how to order your months. Now, when you go back to the Report View and use your "Month Name" column in any chart or slicer, it will be automatically ordered chronologically.
Troubleshooting Common Problems
My visual is still not sorting correctly!
Even after setting the "Sort by Column" property, your specific visual might have its own override sort setting. On your chart, click the three dots icon (... More options) in the top-right corner, go to Sort axis, and ensure it is set to sort by your month name column and that the direction is set to Sort ascending. This should force it to respect the new custom sort order you just defined.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
The 'Sort by Column' button is greyed out.
This happens when you have more than one column selected. Make sure you have clicked on the single column header for your month names and that no other columns are highlighted.
What if my fiscal year doesn't start in January?
This is a great real-world question. In this case, a standard month number (1-12) won’t work. You’ll need to create a "Fiscal Month Number" column instead. For example, if your fiscal year starts in July, you need a column where July = 1, August = 2, ..., June = 12. You can achieve this with a conditional column in Power Query or a more advanced SWITCH or IF formula in DAX to map the correct fiscal month number. The final "Sort by Column" step is exactly the same - you just point it at your new "Fiscal Month Number" column.
Final Thoughts
Sorting months in Power BI is a classic example of learning how the tool thinks. While it initially treats text as just text, a simple helper column is all that's required to provide the logical context it needs to sort chronologically. By creating a numeric month column and using the "Sort by Column" feature, you gain complete control over how your time-based data is presented.
While mastering these small steps is part of the BI journey, we realize that dealing with tedious configurations like this isn't why you started using data in the first place. At Graphed, we handle this tedious work for you. Our AI is designed to understand what you mean, not just what the raw data says. When you ask something as simple as "show me sessions by month from Google Analytics," our platform automatically recognizes that months should be in chronological order and builds the correctly sorted chart in seconds - no need to manually create sorting columns at all.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.