Skip to main content

Sort Data Transform

The Sort Data transform orders rows by one or more columns.

Basic Usage​

To sort rows:

  1. Select the Sort Data transform from the transform menu.
  2. Choose a field under Target Columns.
  3. Set its Order to ascending or descending.
  4. To add another sort column, click +, then choose its Target Columns field and Order. Repeat as needed.
  5. Apply the transformation.

Sort data by one or more columns

Configuration Options​

Basic Options​

  • Target Columns: Select one column in each sort row. Click + to add a row. The order of these rows sets the sort priority.
  • Order: For each selected column, choose either:
    • Ascending (A to Z, 0 to 9)
    • Descending (Z to A, 9 to 0)
note

The first column is the primary sort. Each later column breaks ties left by the columns before it.

tip

The workflow UI puts null/NaN values last for both sort directions. Direct backend configurations can set na_position to first or last, but this setting is not available in the UI.

Examples​

Example: Sorting a Sales Dataset

Input Dataset:

DateProductSalesRegion
2023-05-15B1500North
2023-05-14A1000South
2023-05-16C2000East
2023-05-15A1200West
2023-05-14B800North

Configuration:

  • Column 1: Date (Ascending)
  • Column 2: Product (Descending)

Result:

DateProductSalesRegion
2023-05-14B800North
2023-05-14A1000South
2023-05-15B1500North
2023-05-15A1200West
2023-05-16C2000East

The rows are sorted by Date in ascending order, then by Product in descending order within each date.

Best Practices​

  1. Put the most important sort column first.
  2. Check that each sort column has a consistent data type.
  3. Account for null/NaN values appearing last.
  4. Add a row-number column first if you may need to recover the original order.

Troubleshooting​

  • The order looks wrong: Check the sort column's data type and look for mixed values.
  • Dates sort incorrectly: Use one consistent format and confirm that the column is recognized as a date.
  • Numbers sort incorrectly: Check for text values or hidden characters.