The Sort transform allows various sorting rules to be applied to the input columns and copies the results to the output. The sorting applied is only applicable inside the data cube. The sort transform should never be the last transform before the process result as this will just result in unneccessary processing and overhead.
If the data provider of the previous transform supports sorting then an optimized query will be generated and sent to the server.
The Sort transform requires 1 input transform that has at least 1 column.
The input could be a SQL Select transform, or the result of another transform. For example, a table showing Location and Sales.
Steps to configure the Sort transform:
- Select the column(s) you want to be included in the output.
- Drag and drop the sorting column(s) from the Sorting Transform Input pane to the Sorting Elements pane.
- Click the Sorting Direction to toggle between Ascending (default) and Descending.
The figure below illustrates the output from the Sort transform. Output shows data sorted by Sales in descending order, and then by Location in ascending order.
Important - As you can see, the Sort transform node is in red. Normally, a transform node is in red if there's an issue with the configuration. The Sort transform is in red since there's no other transform right after the Sort transform. Sorting the data for no particular purpose will just result in unnecessary processing and overhead. It is highly recommended that you use the Sort transform in conjunction with another transform, e.g. Pivot or Rank.
To illustrate, in the previous output, data is sorted by Sales from highest to lowest. However, if you use the Data Cube in the dashboard, the data is un-sorted as seen in the screenshot below, and you need to apply the necessary sorting rule in the data binding panel. This is the reason why is is unnecesary to use the Sort transform by itself.