1. Home
  2. Knowledge Base
  3. Working with Data
  4. [Online] – How to use the Sort block

How to use the Sort Block

Sorting data can help the analyst to better understand the data in the data set.  In general, if your table is too large to be sorted (more than 1M rows), you will need to filter the dataset down to reduce the number of values that need to be sorted.  

1. Drag the Sort block to the canvas.

Image

2. Connect the output node from the Calculate block to the input node of the Sort block.

 

Image

3. Select the Sort block. At the bottom of the screen, you will have two sections - on the left, you have the columns of the data source, while on the right, you have the ones you want to use in your sorting.

 

Image

4. From the list on the left, select the columns you want to use and click on the right arrow in the middle.

 

Image

5. To remove the columns, select them on the right side and click the left arrow button.

 

Image

6. To sort by a column, choose one from the right side and select “Ascending” or “Descending” from the Sort Direction. 

 

Image

7. You can also move columns up and down in the field order. The sort works in the following way:

  • The whole document is sorted based on the column that is first on the list;
  • The rest of the columns, from the second one onward, work as secondary sorts within the first one;
  • In the example below, the document is sorted ascending, based on date. Then, for every date, the entries are listed ascending by country, as this is the second column added.

 

Image

8. Click on the output node of the Sort block to see how the document looks like after the sort is applied.

 

https://analyticscanvas.com/wp-content/uploads/2021/02/Image2021-01-26at11.42.09PM.jpg

Was this article helpful?

Related Tutorials/Video