Pivot tables provide a built-in ranking feature, and can rank smallest to largest or largest to smallest. In the example shown, a pivot table is used to group and rank sales by item. The pivot table is also sorted by rank so that the top sales items appear first.
Fields
The source data contains six fields, but only two fields are used to build the pivot table, Item and Amount:
Item has been added as a Row field. The Amount field has been added twice as a value field. The first instance of Amount has been renamed "Sales" and set to sum values:
The second instance of Amount has been renamed "Rank". The rank value is created by setting "Show values as" to "Rank largest to smallest", with Item set as the Base field:
Items are sorted by Rank in Descending order:
Steps
- Create a pivot table, and tick "Add data to data model"
- Add Item field to the rows area
- Add Amount as a Value field, and rename to "Sales"
- Add Amount as a Value field, and rename to "Rank"
- Set Rank to "largest to smallest with Item as the base field
- Sort the pivot table by Item in descending order