Alteryx Sort Tool

The Alteryx sort tool helps you sort the source data based on one or more columns in ascending and descending order. To demonstrate the Alteryx sort, we used the below Customer_Country text file.

Alteryx Sort Tool - Ascending and Descending 0

First, drop the Input Data Tool and within the Configuration tab, click on the down arrow button to connect to a Customer_Country text File.

Alteryx Sort Tool - Ascending and Descending 1

Once you select the text file, the following Resolve File Type window will open. We have chosen the Read it as a delimited text file option and set the Comma.

Alteryx Sort Tool - Ascending and Descending 2

Alteryx Sort Ascending and Descending

Within the Favorites tab, drag the Sort tool to the canvas and add the Input Data tool output to the Sort tool. We can select the field or column names within the Alteryx Sort configuration tab and the sorting order (Ascending or Descending).

Alteryx Sort Ascending and Descending 1

If you click on the down arrow, you can see the list of available columns to perform sorting.

Alteryx Sort Tool - Ascending and Descending 4

We selected the Education Column and the Sort order as the Ascending. It means the Alteryx sort tool has to sort the Customers by Education in ascending order.

Alteryx Sort Tool - Ascending and Descending 5

Run and see the sorted output.

Alteryx Sort Tool - Ascending and Descending 6

This time, we added an occupation column in ascending order. As you can see, Customers are sorted by education and then occupation.

Alteryx Sort Tool - Ascending and Descending 7

We can also use the combination of ascending and descending order. It sorts the customers by eduction in ascending and country name by descending order.

Alteryx Sort Tool - Ascending and Descending 8

When we try to sort the Sales column in ascending order, it has given a strange result. It is because the sales column is of string type.

Alteryx Sort Tool - Ascending and Descending 9

If you want to sort the string column with numeric values, you can try using the Alteryx dictionary order option. It might give the correct result but not recommend.

Alteryx Sort Descending 10

Let me show you a list of languages supported by Alteryx dictionary order.

Alteryx Sort Tool - Ascending and Descending 11

As I said earlier, to sort the numeric values, we have to change the column type to numeric. We added the Select tool in-between the Input and Sort tools and changed the Sales column to double.

Alteryx Select tool 12

Now you can see the Sales columns sorted in ascending order.

Alteryx Sort Tool - Ascending and Descending 13

Here, the sort tool sorts the customers by country in ascending and sales by descending.

Alteryx Sort Tool - Ascending and Descending 14