<!-- https://learnsql.cpetoday.com/functions/m/list-reverse -->
# List.Reverse

Language: Power Query M
Category: List: transform and filter
Syntax: List.Reverse(list)
Summary: Returns the items of a list in the opposite order.
Returns: A new list with the same items, last first.
Level: Beginner
Related: List.Sort, List.Last, List.LastN, List.Skip, List.Accumulate

## 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
- `list`: the list to flip. Only the order changes.

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

```powerquery
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
- Reverse does not sort. It only flips whatever order is there. If the input order is unknown, sort it first.
- Sorting a table by date is safer than reversing a table, because the source order is not guaranteed.
- A reversed list is a new list. Keep the result under its own name.
- Large lists are fast to reverse, but the rule of keeping heavy work in the database still applies.

## 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.
