In this Power Bi tutorial, we will see how to sort a table by Date, Month, Year, and Month Year in chronological order in Power BI. And what are the different ways to sort the data table in Power Bi?
For this tutorial, I have used this Financial Sample Excel file which you can download and use for making the Power BI report.
Power BI sort table by Date
Here we will see how to sort a data table by date in Power BI.
There are two ways that we can sort the data table by date value in Power Bi.
- Using sort by column option
- Sort ascending or descending order option
To achieve it, follow the below steps:
- Open the Power BI Desktop, and load the financial data table using the Get data option. Once the data has been loaded select the data view.
- In the data view, there are two ways that we can sort table by date.
- Open the data view, and click on Column tools -> Sort by Columns -> Date.
- Once you select the date column, it automatically sorts all the rows presented in the table based on the selected date column.
- The second way is to display the date in chronological order by selecting the sort ascending order option as shown below:
- For this, right-click on the date column and then click on Sort ascending if you want to sort in ascending order. In the same way, choose Sort descending, if you want to sort in descending order in Power BI.
This is how to sort data table by Date on the Power BI desktop.
Power BI sort table by month
Here we will see how to sort a data table by month in Power BI.
We can sort a table by month data table values in two different ways in Power Bi. They are,
- Using sort by column option
- Sort ascending or descending order option
To achieve it, follow the below steps:
- To sort table by month in Power BI, we will use the same financial excel sheet, used in the previous topic:’Power BI sort table by date’.
- Now select the data view in Power BI.
- The first way is to select the month column and expand the sort-by-column -> Month Name, it automatically sorts all the rows presented in the table based on the selected month column.
- Another way is to display the month in chronological order by selecting the sort ascending order option as displayed below.
- For this, right-click on the Month name column -> Sort ascending option from the list in Power BI.
- And if you want to sort by descending order, choose the Sort descending option.
This is how to sort table data by month in Power BI.
Power BI sort table by year
Here we will see how to sort table by year column in Power BI Desktop.
There are two ways that we can sort data table by year value in Power Bi. The two different options are,
- Using sort by column option
- Sort ascending or descending order option
Follow the below steps, to achieve it:
- In the previous heading, as we discussed, load the financial data into the Power Bi desktop.
- The first way in the data section is to select the year column in the table.
- Click on the Column tools tab -> Sort by column – >Year column it automatically sorts all the rows presented in the table based on the selected year column.
- The other way is to display the year in chronological order by selecting the sort ascending order option as like below:
- For this, right-click on the Year column and choose the Sort ascending option from the list, In a similar way, if we want to sort the values in descending order, then choose the Sort descending option from the list.
This is an example of how to sort and display the year column in a data table in Power Bi.
Power BI sort table by month and year
Here we will see how we can sort the data table by month and year in Power BI.
It is possible to sort tables by month and year values in two different ways in Power Bi. They are,
- Using sort by column option
- Sort ascending or descending order option
To accomplish it, follow the below steps:
- Here we use the financial data table, used in the previous topic to sort the table by month and year in Power BI
- The first way is to select the month and year columns in the table.
- Click on the Column tools tab -> Sort by column -> Month and Year it automatically sorts all the rows presented in the table based on the selected month and year column.
- The second way is to display the month and year in chronological order by selecting the sort ascending order option as highlighted below:
- For this right-click on the Month name column and click on the Sort ascending option from the list in Power BI. Select the sort descending option, if you want to sort by descending order.
This is how to sort a data table by month and year in Power BI.
In this Power BI tutorial, we have learned how to sort a table by Date, Month, Year-Month, and Year in Power BI in chronological order. Also, we discussed the two different ways to sort data tables in Power Bi.
You may lie the following Power BI tutorials:
- How to remove Date Hierarchy in Power BI
- Power BI date slicer between a default to today
- What if parameter Power BI Date
- Power BI Date slicer only shows dates with data
- How to Add a Date Slicer in Power BI
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com