Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Tool Mastery

Explore a diverse compilation of articles that take an in-depth look at Designer tools.
Become a Tool Master

Learn how you can share your expertise with the Community

LEARN MORE

Tool Mastery | Sort

MattD
Alteryx Alumni (Retired)
Created

Sort.pngThis article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into uses of the Sort Tool on our way to mastering the Alteryx Designer:

 

Often times in data preparation, the need for order in your records will arise. When that situation occurs, the Sort tool has your back. It’s just that sort of tool. Effortlessly arranging your records – be it alphabetical, numeric, or chronological in order – while not quite a mind-numbingly complex operation, has ample utility. Sorting your records upstream of many tools can even optimize processing time. The fairly simple use cases below are techniques that frequently pop up in the data blending trenches:

 

sort.png

Sort Tool, left, helping an analyst take their shots

 

  • Enforcing order for consistent Multi Row Formula calculations (attached in the workflow Sort.yxzp)

1.png

 

  • Listing records in chronological order for reporting (attached in the workflow Sort.yxzp)

Using the Summarize Tool’s (master it here) “First” and “Last” actions are only useful when you know which records will be first and last. The easiest way to do that is to apply a quicksort:

 

2.png

 

  • Order-based record selection (attached in the workflow Sort.yxzp)

3.png

 

Note: The Sort Tool also has a checkbox option to "Use Dictionary Order" that will sort beyond ASCII string characters. Using this feature will impact the speed of your sorts.

 

By now, you should have expert-level proficiency with the Sort Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at community@alteryx.com if you’d like your creative tool uses to be featured in the Tool Mastery Series.

 

Stay tuned with our latest posts every Tool Tuesday by following Alteryx on Twitter! If you want to master all the Designer tools, consider subscribing for email notifications.

Additional Information
Click on the corresponding language link below to access this article in another language -
Portuguese
Spanish
French
German
Japanese

Attachments
Comments
FFFool
9 - Comet

Thanks @MattD, great write-up.

 

Just wanted to note one thing that I found out today. If you accidentally check the "Use Dictionary Order", and are trying to sort chronologically, it can* mess up your sort order. I had this issue on a sort before Dynamic Input causing me to pick up the wrong file. I'm hoping we can have a date field override the Dictionary Order in a future enhancement, but not sure if that will happen.

 

I also haven't tested, but I would assume this would be an issue if you were trying to sort Chronologically and by a String, unless you used separate sort tools. 

 

*(did for me, maybe not always?)

rafialmadrid
5 - Atom

I think you left out the case where the user decides the order with a personalized list, for example, I have the following possibilities of status for an item:

 

Active 

Inactive

Delete

 

If I want the inactives to be ordered above the deleted ones, the alphabetical order won't work as it will rearrange them as folllows:

 

Active 

Delete

Inactive

 

How can I assign the order of my prefrence?

 

Regards

 

ankitsingh2063
8 - Asteroid

Hey @rafialmadrid : did you get the answer to your question?

PraphulSamavedam
8 - Asteroid

Hi @rafialmadrid:

 

Nice point, I think with the existing tools we can still achieve this behavior.

1. Use a formula tool to create this required priority and then sort the data on the basis of that column and finally deselect the newly created column using the Select tool.  

2. Create the custom priority with a text-input file and join the data. Sort the data on the basis of the priority column and finally deselect the newly created column using the Select tool. 

 

I do agree that such an option will be useful. 

DPRC
8 - Asteroid

Great article, thanks for sharing.

mjsnyder
7 - Meteor

Great there is a function to sort the tables on how you would like them to be presented.

Tyrane782001
7 - Meteor

I see it can be useful in some of data, i work with you

VTU15986
5 - Atom

TQ SIR

mvtejano
7 - Meteor

Interesting and very helpful. Thank you.

Gayitri420
7 - Meteor

Interesting and very helpful. Thank you.

Anitha1289
7 - Meteor

Great article, thanks for sharing

Shyam_amarapu_2002
7 - Meteor

5-atom

GuthurthiRaju
6 - Meteoroid

cool

nadiralam
7 - Meteor

I see it can be useful in some of data, i work with you

 

 
 
 
 
 
eliaskurian
6 - Meteoroid

Nice article! Never realized that adding an extra sort tool might increase the efficiency of the workflow. 
Just wanted to point out that the last 2 screenshots in the articles would need to be swapped in order to align them with the description text. 

Mohitku123
6 - Meteoroid

I CAN SEE IT CAN BE HELPFULL IN SOME DATA.

 

Mgaurav2grt
7 - Meteor

best awesome

ydong018
5 - Atom

Love that pic!