Sort Function

Top Previous Topic Next Topic  Print this topic

The Sort function sorts a data source ascending or descending, by a given rule.

To select a type of sorting, the drop down list displayed when selecting the Sort button (located in the Dataset group, under the Home tab) must be accessed.

 

sort2

If a sort function has been already inserted into the document, its sorting order can be modified by right clicking on its corresponding diagram and selecting the Change sort order option.

As input, a data source and a field (after which the data will be sorted) are required.

The output is the sorted version of the input data source.

 

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

 

Sort

 

 

Note:

The above example is part of the SortSample.dax document, located in the 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>