Sorting Pivot Tables in Amazon QuickSight - Amazon QuickSight

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.

Note

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.


	        				Image of a pivot table with a sort highlighted in red.

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).


        					Image of a pivot table showing two measure value columns sorted.

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

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

  2. 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.

    
	        						Animated gif of sorting values in a pivot table using column headers.

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

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

  2. Choose Ascending or Descending.

    
	        						Animated gif of sorting values in a pivot table using value headers.

    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

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

  2. Expand the Field wells.

  3. 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.

      
	        								Image of a field in the Rows field well with the sort by field and alphabetical sort icons indicated in red squares.
    • 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.

      
	        								Image of a field in the Rows field well with the sort by field and sort icons indicated in red squares.

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

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

  2. Expand Field wells.

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

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

    1. For Sort by, choose a field from the drop-down list.

    2. For Aggregation, choose an aggregation from the list.

    3. For Sort order, select Ascending or Descending.

    4. Choose Apply.