Power Query
published
Search
⌃K

List.Sort

List.Sort

Sorts a list of data according to the criteria specified.
function (list as list, optional comparisonCriteria as nullable any) as list

Description

Sorts a list of data, list, according to the optional criteria specified. An optional parameter, comparisonCriteria, can be specified as the comparison criterion. This can take the following values:

Category

List.Ordering

Examples

Sort the list {2, 3, 1}.
List.Sort({2, 3, 1})
{1, 2, 3}
Sort the list {2, 3, 1} in descending order.
List.Sort({2, 3, 1}, Order.Descending)
{3, 2, 1}
Sort the list {2, 3, 1} in descending order using the Value.Compare method.
List.Sort({2, 3, 1}, (x, y) => Value.Compare(1/x, 1/y))
{3, 2, 1}
Last modified 4yr ago