Sort Function

Top Previous Topic Next Topic  Print this topic

Sort Function sorts a data source ascending or descending by a given rule.

To select the type of sorting you want to use, go to the Dataset group, click on the arrow below Sort and select one of the two options available: Ascending or Descending as in the image below:

 

sort2

If you have already added a sort function with one type of sorting (for example Ascending) in the Design View and you want to change it, just right click on it and select Change sort order and the type of sorting will automatically change to the other option: Descending.

 

The input for this function is a data source and a field indicating the rule to sort by. The output is the sorted version of the input data source.

 

The following sample displays the concatenated values of first-name and last-name sorted ascending by first-name.

 

Sort

 

 

Note. This sample can be found in SortSample.dax from Samples\Job Samples folder.

 

OUTPUT:

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns:root xmlns:ns="http://www.tempuri.org/XML">

       <ns:element-name full-name="Arthur Clark"/>

       <ns:element-name full-name="John Brown"/>

       <ns:element-name full-name="Mary Jane"/>

</ns:root>