Table.ReverseRows
TableReverses the order of rows in a table.
Syntax
Table.ReverseRows(table as table) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table whose rows to reverse. |
Return Value
table — A 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 | |
|---|---|---|---|
| 1 | 4 | Alice | Gadget D |
| 2 | 3 | Charlie | Widget C |
| 3 | 2 | Bob | Gadget B |
| 4 | 1 | Alice | Widget A |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks