CONTENT
Title Component
How to sort by month in Power BI
Learn how to sort months correctly in Power BI by creating a Month Number column and using it to sort your visualizations accurately.
Saartje Ly
Data Engineering Intern
May 5, 2024
Sorting by month
Sorting by month in Power BI can be particularly annoying, especially if sorting by ascending or descending bases the sort in alphabetical order of the months, not the months themselves.
1. The first thing we want to do is create a new column. Navigate to your Dates table (where Month is stored), click the three dots by the table name, and select New column.
2. Write this DAX function into the box at the top to create a Month Number column. Dates represents the Dates table, and Date represents the Date column we want to sort by. Note that this Date column doesn’t have to be your Month field. You could have another Date field that the DAX expression can extract the month out of. Press enter.
3. Click on your Month field in the Data pane, then navigate to Column tools.
4. Click Sort by column inside Sort
5. Select Month Number
6. Go back to the three dots up the top of your visualization, open Sort axis, make sure Month and Sort ascending are selected.
Your visualization is now sorted correctly by months.
Sorting by month
Sorting by month in Power BI can be particularly annoying, especially if sorting by ascending or descending bases the sort in alphabetical order of the months, not the months themselves.
1. The first thing we want to do is create a new column. Navigate to your Dates table (where Month is stored), click the three dots by the table name, and select New column.
2. Write this DAX function into the box at the top to create a Month Number column. Dates represents the Dates table, and Date represents the Date column we want to sort by. Note that this Date column doesn’t have to be your Month field. You could have another Date field that the DAX expression can extract the month out of. Press enter.
3. Click on your Month field in the Data pane, then navigate to Column tools.
4. Click Sort by column inside Sort
5. Select Month Number
6. Go back to the three dots up the top of your visualization, open Sort axis, make sure Month and Sort ascending are selected.
Your visualization is now sorted correctly by months.
Sorting by month
Sorting by month in Power BI can be particularly annoying, especially if sorting by ascending or descending bases the sort in alphabetical order of the months, not the months themselves.
1. The first thing we want to do is create a new column. Navigate to your Dates table (where Month is stored), click the three dots by the table name, and select New column.
2. Write this DAX function into the box at the top to create a Month Number column. Dates represents the Dates table, and Date represents the Date column we want to sort by. Note that this Date column doesn’t have to be your Month field. You could have another Date field that the DAX expression can extract the month out of. Press enter.
3. Click on your Month field in the Data pane, then navigate to Column tools.
4. Click Sort by column inside Sort
5. Select Month Number
6. Go back to the three dots up the top of your visualization, open Sort axis, make sure Month and Sort ascending are selected.
Your visualization is now sorted correctly by months.
CONTENT
Title Component
SHARE