Order.Ascending

Order.Ascending (0) is an enumeration that specifies the direction of sorting. It is a member of the Order.Type and indicates that values should be sorted in ascending order.

Examples

You can apply sorting criteria to the List.Sort function.

// Below statements return { 1, 2, 3 }
= List.Sort( { 2, 3, 1 } )
= List.Sort( { 2, 3, 1 }, 0 )
= List.Sort( { 2, 3, 1 }, Order.Ascending )

When you have a table called Source with the column Date, the following code sorts the table by date.

= Table.Sort(
    Source,
    { "Date", Order.Ascending }
)

= Table.Sort(
    Source,
    { "Date", 0 }
)

Similarly, the Table.AddRankColumn function can make use of the Order.Ascending sorting type to specify how to rank a column.

= Table.AddRankColumn( 
    Source, 
    "Rank", 
    {"Data Type", Order.Descending } 
)

Learn more about Order.Ascending in the following articles:

Other related enumerations are:

Applies to

Here’s a list of functions that work with Order.Type:

BI Gorilla Blog

Last update: August 17, 2023 | Contribute » | Contributors: Rick de Groot
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.