How to Sort Months in Power BI

Cody Schneider7 min read

Nothing breaks the flow of a great dashboard quite like a chart that lists months alphabetically: April, August, December, February. It's a classic Power BI rite of passage, and luckily, it's also an easy fix. This article will walk you through exactly why this happens and how to correctly sort your months chronologically once and for all.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Why Power BI Sorts Months Alphabetically By Default

Before diving into the fix, it's helpful to understand the "why." By default, Power BI sees text fields like "January," "February," or "March" as simple strings of an alphabet. It has no built-in understanding that "January" comes before "February." So when you drop a month name field into a chart, its default behavior is to apply the most logical sorting for text: A-to-Z order.

To get the correct chronological order, you need to explicitly tell Power BI the logical sequence for these text values. You do this by creating a separate numeric column that corresponds to the month names (e.g., 1 for January, 2 for February) and then instructing Power BI to use that numeric column to sort the text column. Let's get it done.

Solution: Sort Month Names by Month Number

The solution involves two main steps: first, ensuring you have a numeric "Month Number" column associated with your month names, and second, using the "Sort by Column" feature to apply the logic.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 1: Create a Month Number Helper Column

If your dataset doesn't already have a column for the month number, you'll need to create one. This is a crucial step that gives Power BI a numerical index to sort with. You can do this easily using a DAX calculated column.

How to Create the Column with DAX

  1. Navigate to the Data view in Power BI (the table icon in the left-hand navigation pane).
  2. Select the table that contains your date and month information. A dedicated Date Table is best practice, but this will work on any table with a date column.
  3. From the "Table tools" or "Column tools" ribbon at the top, click on "New column."
  4. A formula bar will appear. Enter the following DAX formula. Be sure to replace 'YourTableName'[DateColumn] with the actual names:
Month Number = MONTH('YourTableName'[DateColumn])
  1. Press Enter. Power BI will instantly create a new column containing the corresponding month number (1-12) for each date in your table.

Pro Tip: You can also accomplish this in the Power Query Editor during the data transformation phase. Go to the "Add Column" tab, select your date column, and use the "Date" dropdown to add a "Month" > "Month" column, which gives you the month number.

Step 2: Use the "Sort by Column" Feature

Now that you have your month text ("January") and your month number ("1") in the same table, you can link them. This is where you tell Power BI, "Hey, don't sort this text column alphabetically. Instead, use this other numeric column to define its order."

  1. Stay in the Data view.
  2. Crucially, click to select the column with the month names (e.g., "Month Name," "Month," etc.). This is the column whose sorting behavior you want to change.
  3. With the month name column selected, navigate to the "Column tools" tab in the ribbon at the top of the screen.
  4. Click on the "Sort by Column" button.
  5. A dropdown list of other columns in your table will appear. Select the "Month Number" column you just created.

That's it! Power BI may take a second to process, but behind the scenes, it has just created a rule. From now on, whenever you use the "Month Name" column in a visual, it will be automatically sorted according to the "Month Number" column.

Step 3: Verify Your Visual Sorted Correctly

Switch back to the Report view. Your chart, table, or matrix that was previously sorted alphabetically should now be perfectly ordered from January to December. If your month axis doesn't appear sorted correctly, click the three dots (...) at the top corner of the visual, select "Sort axis," make sure it is sorted by your month name column, and in "Ascending" order.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Bonus Challenge: How to Sort "Month-Year" Data (e.g., Jan 2024, Feb 2024)

A very common follow-up challenge is dealing with data that spans multiple years. If you create a visual with a column formatted as "Month Year" (e.g., "January 2024"), you'll run into the same sorting problem. Sorting by a simple "Month Number" won't work, because it will group all "Januarys" together, regardless of the year.

The principle is the same: you need a helper column that can order the text chronologically. In this case, a format like YYYYMM is perfect because it sorts correctly both numerically and alphabetically.

Step 1: Create a "Month-Year" and a "Sort" Column using DAX

If they don't already exist, create these two new calculated columns in your Date table:

  • Create the display column (what you'll see on the chart):
Month Year = FORMAT('YourTableName'[DateColumn], "mmmm yyyy")

This creates a readable text column like "January 2023", "February 2023", etc.

  • Create the helper sort column (what Power BI will use for logic):
YYYYMM Sort = FORMAT('YourTableName'[DateColumn], "yyyymm")

This creates an unambiguous numeric key like 202301, 202302... which will always sort chronologically.

Step 2: Apply the Sort by Column Logic

Just like before:

  1. In the Data view, click to select your readable "Month Year" column.
  2. Go to the "Column tools" tab.
  3. Click "Sort by Column" and choose your "YYYYMM Sort" column.

Now, when you use the "Month Year" column in your visuals, it will correctly sort across years: "December 2023" will be followed by "January 2024," just as it should be.

Troubleshooting Common Issues

Even a straightforward process can hit a snag. Here are a couple of common issues you might encounter.

The "Sort by Column" button is grayed out!

This almost always means you have the wrong column selected. Remember, you must select the text column you want to affect (e.g., "Month Name"), not the helper numeric column you want to sort by ("Month Number").

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

An error message about more than one value in the sort column.

You may see an error like: "We can't sort the [Month Name] column by [Month Number]. There can't be more than one value in [Month Number] for the same value in [Month Name]."

This error is telling you that there's a disconnect in your data model. For "Sort by Column" to work, there must be a clean one-to-one relationship between the unique values. For example, the text "January" must always correspond to the number "1," not for the text "January" to map to multiple values in your table. The best way to prevent this and other data modeling issues is to use a dedicated Date Table in your model and build relationships to it.

Final Thoughts

Fixing month sorting is a foundational skill in Power BI that shifts your reports from confusing to professional. The core method is always the same: create a dedicated column that contains the sort order logic (like a month number), and then use the "Sort by Column" feature to apply that logic to your text-based month column.

Learning these technical steps is a core part of mastering any business intelligence tool, but it's also where a lot of time and mental energy can get stuck. We built Graphed because we wanted to eliminate these kinds of tedious requirements. Instead of manually creating helper columns and remembering which ribbon to click, you can just ask in plain English: "Show me my sales by month this year," and our AI handles all the sorting, data modeling, and visualization behind the scenes, creating a live, interactive dashboard for you in seconds.

Related Articles