Table.ReorderColumns is a Power Query M function that reorders columns in a table according to a specified column order. The function returns a new table with the columns reordered, handling missing columns based on an optional parameter.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.ReorderColumns(
table as table,
columnOrder as list,
optional missingField as nullable number,
) as table
Argument | Attribute | Description |
---|---|---|
table | ||
columnOrder | ||
missingField | optional | The MissingField.Type determines the function’s reaction to operations on missing columns. When omitted, it uses MissingField.Error and generates an error for missing columns. Alternatives include MissingField.UseNull, substituting null for missing columns, and MissingField.Ignore, which ignores missing columns. |