How to Sort a Power BI Table by Multiple Columns?

Do you know how to sort a Power BI Table by Multiple Columns? No worries!

In this tutorial, I will explain how to sort by multiple columns in the Power BI table visual.

Also, I will tell you how to sort by multiple columns in the Power BI matrix visual.

How to Sort a Power BI Table by Multiple Columns

In Power BI, sorting a table by multiple columns means arranging the data in a specific order based on more than one column.

For example:

In Power BI, Imagine a table having various columns with different data types. Sorting by more than one column allows you to arrange the data according to a first column (Name), and then a second column (Region, Total) for rows that have the same values in the first column.

Sort a Power BI Table by Multiple Columns

Below is the SharePoint list we will use to sort a Power BI Table by multiple columns.

ColumnsData Types
NameSingle line of text
DateSingle line of text
RegionSingle line of text
TotalCurrency
Unit CostCurrency
UnitsNumber
Multiple columns sorting in Power BI

Now we see how to sort a table using multiple columns in Power BI

1. Open the Power BI Desktop and load data using the Get data option. Then, we can see the data set in the Data Panel.

Sorting a table using multiple columns

2. Under the Visualizations panel, click the Table visual.

Sort A Table Using Multiple Columns In Power BI

3. Then drag and drop Name, Date, Region, Total, Unit Cost, and Units into the Columns field.

How to Sort a Power BI Table by Multiple Columns

4. Press Shift + Left Click on the Column Header for which we want to apply Multiple Sort.

Here, I will select the Name Column with Shift + Left Click. In the screenshot below, You can see first it sorts the data based on the Name.

Sorting a Power BI table by multiple columns

5. Then, it sorts data for the Region and Total columns using  Shift + Left Click.

Power BI sort by multiple columns

This way, sort the table by multiple columns in a Power BI report.

Sorts by Multiple Columns in the Matrix in Power BI

Now we see how sorts by multiple columns in the matrix in Power BI

Note:

The Matrix visual in Power BI does not currently allow sorting across multiple columns simultaneously. Sorting is limited to individual columns within the Matrix visual.

Now, I will tell you how to sort the single column in the Matrix visual.

1. Load the data into Power BI Desktop using the ‘Get Data’ option. Then, from the visualizations panel, select the Matrix visual.

Power BI sort by multiple columns in the matrix

2. Then drag Name and Region into the Rows field and Total, Unit Cost, and Units into the Values field.

Power BI sort column in the matrix

3. Click on the Column Header to apply the sort on the matrix visual. In my case, I click Name in descending order.

Sorts by Columns in the Matrix in Power BI

In this way, you can sort columns in the Power BI matrix visual.

Conclusion

I hope you follow the above steps to sort a Power BI Table by multiple columns.

In this tutorial, we learned how to sort table by multiple columns in Power BI and how to sort columns in the Matrix in Power BI.

Also, you may like some more Power BI tutorials: