Example – Sorting a Text Table

Using the Superstore sample data source, this example sorts the rows and columns of a text table to determine which products and years have the highest average discounts. To create the view, follow the steps below:
  1. Place the Order Date dimension on the Columns shelf and the Category dimension on the Rows shelf.
    Complete the text table by placing Discount on Text. By default, the table is sorted in alphabetical order.

  2. Sort the fields.
    Right-click on Order Date field and select Sort. In the Sort dialog box select Descending as the Sort Order and sort by Discount aggregated as an Average. When finished click OK. Then apply the same sort to Category.

The view is shown below. Rubber Bands is the top row in the table because it has the largest average discount across all years, while Telephones and Communications are at the bottom in the table because that category has the smallest average discount across all years. Similarly, 2012 is the left most column because it has the largest average discount for all products, while 2011 is the right most column because it has the smallest average discount for all products.

At first glance, it’s not clear if the data has been correctly sorted. That’s because Tableau computes the sort across the entire table using the specified criteria. By turning grand totals on for both columns and rows, using the Table menu, you can see that the sort was performed correctly.

No comments:

Post a Comment