# Rank transaction

## Scenario

Rank a person's holiday bookings by Booking Date (Latest to Earliest)

- Open a new **Expression** window from **Toolbox** ribbon bar and set the table level to **Bookings**
- Click on the **Add Aggregation** button
- Click on the tab entitled **Frequency(Bookings)** and change **Type** box to show **Rank Transaction**

  > **Note**
  >
  > The auto-naming feature will populate the Name box until you change it.
- Leave the Grouping Table as **People** and Transactional Table as **Bookings**
- Drag the **Booking Date** variable onto the **Drop your ordering variable here** drop box and change the order display to **Latest to Earliest**
- Click the **Build** button to see a preview of the results

A **Data Grid** can be used to validate the results:

The example above demonstrates how you can take an ordered set of transactions and rank them from 1 to N. There is also the option to **Group by** and add a grouping selector variable and the ranks to be calculated within each grouping category. This allows you to identify, for example, "the first / last N transactions to each booking Destination" or "the most expensive transaction to each booking Destination".
