Sorting pivot tables in Amazon QuickSight
In Amazon QuickSight, you can sort values in a pivot table by fields in the Rows and Columns field wells or quickly by column headers in the pivot table. In pivot tables, you can sort rows and columns independently of each other in alphabetical order, or by a measure.
You can't run Total, Difference, and Percent Difference table calculations when a pivot table is being sorted by a measure. For more information about using table calculations in pivot tables, see Using table calculations in pivot tables.
Understanding sorting in pivot tables
When you have multiple panes in a pivot table, sorting is applied to each pane
independently. For example, the Segment
column in the pivot
table on the left is being sorted in ascending order by Cost
.
Given that there are multiple panes, the sort starts over for each pane and
the rows within each pane (for Segment
) are ordered by lowest
to highest cost. The table on the right has the same sort applied, but the
sort is being applied across the entire table, as shown following.
When you apply multiple sorts to a pivot table, sorting is applied from the outside
dimension to the inside dimension. Consider the following example image of a
pivot table. The Customer Region
column is sorted by
Cost
in descending order (as shown in orange). The
Channel
column is sorted by Revenue Goal in ascending order
(as shown in blue).
Sorting pivot tables using row or column headers
Use the following procedure to sort a pivot table using Row or Column headers.
To sort values in a pivot table using table headers

In a pivot table chart, choose the header that you want to sort.

For Sort by, choose a field to sort by and a sort order.
You can sort dimension fields alphabetically a–z or z–a, or you can sort them by a measure in ascending or descending order.
Sorting pivot tables using value headers
Use the following procedure to sort a pivot table using value headers.
To sort a pivot table using value headers

In a pivot table chart, choose the value header that you want to sort.

Choose Ascending or Descending.
Sorting by value headers in a pivot table also works on subtotals.
Sorting pivot tables using the field wells
Use the following procedure to sort values in a pivot table using the field wells.
To sort values in a pivot table using the field wells

On the analysis page, choose the pivot table that you want to sort.

Expand the Field wells.

In the Rows or Columns field well, choose the field that you want to sort, and then choose how you want to sort the field for Sort by.
You can sort dimension fields in the Rows or Columns field wells alphabetically from a–z or z–a, or you can sort them by a measure in ascending or descending order. You also have the option to collapse all or expand all rows or columns for the field you choose in the field well. You can also remove the field, or to replace it with another field.

To sort a dimension field alphabetically, hover your cursor over the field in the Rows or Columns field well, and then choose the a–z or z–a sort icon.

To sort a dimension field by a measure, hover your cursor over the field in the Rows or Columns field well. Then choose a measure from the list, and then choose the ascending or descending sort icon.

Or, if you want more control over how the sort is applied to the pivot table, customize the sort options.
To create a sort using the sort options

On the analysis page, choose the pivot table that you want to sort.

Expand Field wells.

Choose the field that you want to sort in the Rows or Columns field well, and then choose Sort options.

In the Sort options pane that opens at left, specify the following options:

For Sort by, choose a field from the dropdown list.

For Aggregation, choose an aggregation from the list.

For Sort order, select Ascending or Descending.

Choose Apply.
