Page tree


Contents:

Our documentation site is moving!

For up-to-date documentation of Dataprep, please visit us at https://help.alteryx.com/Dataprep/.

   

Contents:


You can sort the ordering of rows in your dataset based on the values in one or more columns.

Sort Order

The order of rows is determined by how the application orders for a sort column's data type.

NOTE: In  Dataprep by Trifacta, sorting transformations are applied only to the data within the Transformer page. Sort order based on these transformations cannot be guaranteed in any related outputs.

For more information, see Sort Order.

Example Dataset

rowIdlastNamefirstNamestartDate
3JonesTim2022-05-01
1JonesCary2022-03-15
2AbbottMichael2022-02-07

Sort by a Single Column

To sort rows by the values in a single column, click the column menu and then select one of the following options:

  • Sort A → Z: Sort the rows in the dataset in ascending order, as determined by the data type of the column.
  • Sort Z → A: Sort the rows in descending order, as determined by the data type of the column.

Transformation:

For the example dataset above, suppose you want to sort the rows based on the rowId value in ascending order. From the rowId column menu, you could select Sort A → Z, which yields the following step in your recipe.

Transformation Name Sort rows
Parameter: Sort by rowId

Results:

The resulting dataset looks like the following:

rowIdlastNamefirstNamestartDate
1JonesCary2022-03-15
2AbbottMichael2022-02-07
3JonesTim2022-05-01

For more information, see Column Menus.

Reversing Sort Order

Suppose you wish to reverse the sort order of the above transformation to organize the rows in descending order based on the rowId column.

Transformation:

You can edit the recipe step and insert a dash (-) in front of the rowId value:

Transformation Name Sort rows
Parameter: Sort by -rowId

Results:

rowIdlastNamefirstNamestartDate
3JonesTim2022-05-01
2AbbottMichael2022-02-07
1JonesCary2022-03-15


Sort by Multiple Columns

You can sort by multiple columns in a single step. 

Tip: To perform multi-column sorts, search for Sort rows  in the Transform Builder and specify the columns manually.

In this example, you wish to sort the lastName column and then descending order of the firstName column.

Transformation:

This transformation looks like the following:

Transformation Name Sort rows
Parameter: Sort by lastName
Parameter: Sort by -firstName

Results:

rowIdlastNamefirstNamestartDate
2AbbottMichael2022-02-07
3JonesTim2022-05-01
1JonesCary2022-03-15

See Also for Sort Rows:


This page has no comments.