Downloads
Power Query MList: transform and filterBeginner

List.Reverse

Returns the items of a list in the opposite order.

Syntax
List.Reverse(list)

Returns: A new list with the same items, last first.

What it does

List.Reverse flips a list so the last item becomes the first. It is handy when a source lists oldest first and a report needs newest first, or when you want the most recent values from a series.

Syntax and arguments

Example

A cash report lists the month-end balances from January to December. The treasurer wants to see the last few months first.

let
    Balances = {"Jan", "Feb", "Mar", "Apr"},
    NewestFirst = List.Reverse(Balances)
in
    NewestFirst

The result is {"Apr", "Mar", "Feb", "Jan"}. For a sorted list in descending order, List.Sort with Order.Descending often reads more clearly. Reverse is best when the order is already correct and you only need it flipped.

Example: a second, different use

Taking the three most recent values from a list that is stored oldest first: List.FirstN(List.Reverse(Balances), 3) returns {"Apr", "Mar", "Feb"} for the four months above.

Things to watch

In business terms

Newest-first transaction lists, the latest periods at the top of a trend and last-in, first-out views of inventory layers are common uses. Being explicit about the order makes a report easier to check.

Related functions

All Power Query M functions · View as Markdown · M basics