Record.RenameFields
This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.
Returns a new record that renames the fields specified. The resultant fields will retain their original order. This function supports swapping and chaining field names. However, all target names plus remaining field names must constitute a unique set or an error will occur.
Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record
| Argument | Description |
|---|---|
| record | The record to modify. |
| renames | The list of renames to apply. |
| optional missingField | A MissingField enum value to handle missing fields. The default value is MissingField.Error. |
MissingField enum
MissingField.Error = 0;MissingField.Ignore = 1;MissingField.UseNull = 2;
- Record.RenameFields swaps and chains field names. If all target names plus remaining field names are not a unique set, an Expression.Error is thrown
Record.RenameFields([OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {"UnitPrice","Price"})
equals [OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]
| OrderID | 1 |
| CustomerID | 1 |
| Item | Fishing rod |
| Price | 100 |
Show: