Table.ReverseRows

Table

Reverses the order of rows in a table.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.ReverseRows(table as table) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe table whose rows to reverse.

Return Value

tableA table with the rows in reverse order.

Remarks

Table.ReverseRows flips the row order of a table so the last row becomes the first and vice versa. This is useful for reversing a sort without specifying sort columns, or for processing data that was loaded in the wrong order.

Examples

Example 1: Reverse row order

Table.SelectColumns(Table.ReverseRows(Table.FirstN(Sales, 4)), {"OrderID", "CustomerName", "Product"})
Result
OrderID
CustomerName
Product
14AliceGadget D
23CharlieWidget C
32BobGadget B
41AliceWidget A

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks