Power Query
Search…
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}.
1
List.Sort({2, 3, 1})
Copied!
{1, 2, 3}
Sort the list {2, 3, 1} in descending order.
1
List.Sort({2, 3, 1}, Order.Descending)
Copied!
{3, 2, 1}
Sort the list {2, 3, 1} in descending order using the Value.Compare method.
1
List.Sort({2, 3, 1}, (x, y) => Value.Compare(1/x, 1/y))
Copied!
{3, 2, 1}
Last modified 3yr ago