Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Sort a Power BI Table by Multiple Columns

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To sort a Power BI table by multiple columns, use the Sort by Column feature in the Fields well: click the first column in the table visual so its sort arrow appears, set the sort direction, then hold Shift and click the second column to add it as a secondary sort. This gives you layered sorting without needing any DAX. If you need a fixed, always-on order, you can instead build the sort order into the data model or write a measure, but for quick changes on a single visual the Fields well approach is the fastest and most reliable.

What You'll Need

  • Power BI Desktop (the multi-column sort controls live in the visual's Fields well, which is easiest to use on desktop).
  • An open report with a Table or Matrix visual already on the canvas, using at least two columns from your data.
  • Fields whose data types make sense for sorting: text, numbers, dates. Mixed text and number types in one column produce odd results.
  • For the model-level approach, permission to edit the semantic model, since Sort by Column is a column property, not a visual setting.

Menu labels can differ slightly between versions, desktop and the Service, and regions, so if a wording does not match exactly, look for the equivalent item.

Step-by-Step

  1. Select your visual. Click the table or matrix on the canvas. The Fields well appears on the right with each field listed as a small chip.
  2. Sort by the first column. Click the first column chip once. A small arrow appears on the chip showing the current direction. Click again (or use the sort arrows in the visual's header) to flip between ascending and descending.
  3. Add a second sort key. Hold the Shift key and click the second column chip. Power BI adds it as a secondary sort, applied wherever the first column has duplicate values. The order in which arrows appear on the chips tells you the priority.
  4. Add more levels if needed. Keep holding Shift and clicking further columns to extend the chain. Realistically two or three levels cover most reports; each extra level only takes effect after the previous ones tie.
  5. Check the result in the visual. Look down the first column, then the second. Rows should group by the first column first, then break ties by the second. If not, you likely added the second sort without Shift, which replaced the first sort instead of extending it.
  6. Remove a level. Click the chip whose sort you no longer want without Shift, or clear the sort arrow, then reapply the order you want from the remaining chips. There is no single "clear all sorts" button, so it helps to reapply from the top.
  7. Save the report. Multi-column sorts set this way are saved with the visual, so anyone opening the report sees the same order.

If you want a column to always sort by a different field (for example month names sorting by month number, or weekdays sorting Monday first), that is a model setting rather than a visual sort:

  1. In the Data view or Model view, select the column you want to sort (such as Month Name).
  2. On the Column tools ribbon, find Sort by column. Labels vary slightly by version; it sits with the column formatting options.
  3. Choose the numeric or date column that defines the correct order (such as Month Number).
  4. Go back to the visual and click the Month Name chip. It now sorts by the hidden column, so alphabetical order no longer applies.

Common Mistakes

  • Clicking without Shift. The most frequent problem: clicking a second chip normally replaces the sort. The multi-column chain only builds while you hold Shift.
  • Sorting a measure instead of a column. Clicking a measure chip sorts the visual by the measure's value, not by column ordering, and can override your column sorts.
  • Expecting a sort in the query editor to carry over. Sorting rows in Power Query sets the load order but does not guarantee visual order; always sort in the visual or model.
  • Month and weekday names in alphabetical order. A visual cannot fix this alone; use Sort by Column in the model.
  • Mixed data types. Numbers stored as text, or a column with blanks, can place values in unexpected positions. Fix the type in Power Query first.
  • Confusing sort with group or filter order. Sorting rearranges rows; it does not group, total or filter them.

Tips

  • The order of chips in the Fields well is not the sort priority; the order in which you apply the sorts is. Reapply from the top if you get confused.
  • For a report that should always show newest first with ties broken alphabetically, sort by date descending, then by name ascending.
  • Use the Model view's Sort by column for any text column that has a natural order (months, weekdays, priority levels, sizes such as Small, Medium, Large).
  • When you need a dynamic ranking (top customers by changing values), let a measure drive the sort; when you need stable rows, sort by columns.
  • Keep sort columns in the model rather than adding hidden helper columns to the visual, so the table stays clean and readable.
  • Test the visual after adding filters. A sort can look wrong when a filter leaves only tied values in the first column.

Troubleshooting

The second sort replaces the first. You clicked without Shift. Reapply the first sort, then Shift-click the second and confirm two arrows are visible on the chips.

The sort arrows do not appear at all. Make sure the visual is selected and you are clicking directly on a field chip, not on the column header in the table. Clicking a header sorts that column and can also clear other sorts.

Month or weekday names are still alphabetical. The model lacks a Sort by column mapping. Set it in the model, then refresh the visual; you may need to reselect the field in the well.

Totals or subtotals move unpredictably. Sorting applies to detail rows; subtotal placement follows the matrix row hierarchy. Expand or collapse levels and check the order again.

Numbers sort as text. Check the data type in the model and in Power Query. A column typed as text sorts character by character, so 10 lands before 2.

Nothing changes at all. The field may be a measure or a calculated column with a defined sort order; verify by checking the chip type and the model properties. If it still misbehaves, refresh the report and reopen the visual's fields.

Frequently Asked Questions

Can I sort by more than two columns?

Yes. Hold Shift and click additional chips in the order you want the priorities applied. There is no practical limit in the interface, though most tables only need two or three levels.

Does the multi-column sort save with the report?

Yes, sorts applied in the Fields well are stored with the visual, so viewers see the same order when they open or refresh the report.

Why does clicking a second column lose my first sort?

Because Shift was not held. Power BI treats a plain click as a new sort for that column. Reapply both in order with Shift.

Can I sort by a measure and a column together?

Yes, but the measure sort takes over the value ordering. Set the measure sort first, then Shift-click the column chip to break ties among equal measure values.

How do I sort a table in the Power BI Service?

In the editing view, use the same Fields well controls by selecting the visual. In the reading view, click a column header to sort that column, but multi-column sorting is limited outside the editing interface.

Is there a keyboard shortcut for adding a sort?

Shift is the modifier: Shift-click a chip to add it to the existing sort chain rather than replacing it.