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.
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.
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 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).
If you click on the down arrow, you can see the list of available columns to perform sorting.
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.
Run and see the sorted output.
This time, we added an occupation column in ascending order. As you can see, Customers are sorted by education and then occupation.
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.
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.
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.
Let me show you a list of languages supported by Alteryx dictionary order.
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.
Now you can see the Sales columns sorted in ascending order.
Here, the sort tool sorts the customers by country in ascending and sales by descending.