Order.Ascending

Updated on

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:

Contribute » | Contributors: Rick de Groot

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy