Forum Discussion
sorting months in order
how can I sort my months in order?
Hi mkane12 ,
Thank you for your follow-up, and you’re correct to highlight that. If you’re already using a date table, such as a Calendar table with all dates included, there’s no need to create a separate Month table just for sorting. You can sort the month names directly in your existing date table.
Make sure your table has a column for the month name (like "January", "February") and another for the month number (1 to 12).
Thank you.
13 Replies
- burakkaragozSuper User
Hi mkane12 ,
Thanks for your question! Sorting months in the correct chronological order is a common challenge in Power BI, especially when months are stored as text.
Here's how to fix it:
Create a Month Number Column\ If your month names are in a column (e.g., "January", "February", etc.), create a new column that assigns a number to each month:
MonthNumber = SWITCH( TRUE(), 'YourTable'[Month] = "January", 1, 'YourTable'[Month] = "February", 2, 'YourTable'[Month] = "March", 3, 'YourTable'[Month] = "April", 4, 'YourTable'[Month] = "May", 5, 'YourTable'[Month] = "June", 6, 'YourTable'[Month] = "July", 7, 'YourTable'[Month] = "August", 8, 'YourTable'[Month] = "September", 9, 'YourTable'[Month] = "October", 10, 'YourTable'[Month] = "November", 11, 'YourTable'[Month] = "December", 12 )Sort by Month Number
- Go to the Data view.
- Select the column with month names.
- In the ribbon, click Sort by Column and choose the MonthNumber column.
This will ensure your months appear in the correct order in visuals and tables.
For more on sorting in Power BI, check out:
https://learn.microsoft.com/power-bi/create-reports/desktop-sort-by-columnLet me know if your months are part of a date field or if you need help adapting this to your model!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
- mkane12Helper I
hi, my months are part of a date field, I do not have a column with just Months
- MasonMASuper User
Hi mkane12 ,
This wouldn't be a good long-term strategy, but for now if you just wanted to sort them with a simple way, you'd still need to extract your MonthNumber from your date by creating one new calculated column. (To use below DAX, You date should be in 'Date' data type, not 'Text' data type)
MonthNumber = MONTH('Table'[Date])then Select MonthName column by going to Column tools, Sort by column 'MonthNumber'.
- MasonMASuper User
Hi, my advise would be,
create your date table with Power Query Guru Melissa De Korte's ultimate date function in Power Query. https://forum.enterprisedna.co/t/melissa-date-table-replacing-fiscal-to-financial-year/58870/4
Keep the Month number or Year number as part of your date table (or you can add any other necessary columns later). This would save you a lot of time writing/having AI generate DAX later.
After date table loaded into Power BI, build one to many relationship with your fact table so that this Data table can filter your fact table.
Sort by Month number under Data view, or if in other types of visuals you can sort them in tooltips as well.
- v-tejramaCommunity Support
Hi mkane12 ,
Thanks for reaching out to the Microsoft fabric community forum.
I encountered the same problem with the months displaying alphabetically instead of from January to December. To resolve it, I built a separate Month Table with two columns: MonthName (e.g., January, February) and MonthNum (1–12). I then used the "Sort by Column" feature on MonthName, sorting it by MonthNum.
Using this MonthName in the visual ensures the months now appear in the correct calendar order.
Please find the attached .pbix file for your reference.
Best Regards,
Tejaswi.- mkane12Helper I
this doesn't work as I already have a table with dates, so that table needs the order.
- v-tejramaCommunity Support
Hi mkane12 ,
Thank you for your follow-up, and you’re correct to highlight that. If you’re already using a date table, such as a Calendar table with all dates included, there’s no need to create a separate Month table just for sorting. You can sort the month names directly in your existing date table.
Make sure your table has a column for the month name (like "January", "February") and another for the month number (1 to 12).
Thank you.
- parry2kSuper User
mkane12 if you don't have a sorting column (month number) on which you want to sort month names, nothing will work. You need to create a column for sorting. Read more about it here Sort one column by another column in Power BI - Power BI | Microsoft Learn