Table of contents
TOC
Collapse the table of content
Expand the table of content

Table.ReorderColumns

Owen Duncan|Last Updated: 10/5/2018
|
1 Contributor

About

Returns a table with specific columns in an order relative to one another, without changing the order of the columns that aren’t specified.

Table.ReorderColumns(table as table, columnOrder as list, optional missingField as nullable number) as table  

Arguments

ArgumentDescription
tableThe Table to modify.
columnOrderThe list of columns to arrange in the specific order.
optional missingFieldThe default value of missingField is MissingField.Error. For more information, see Parameter Values.

Remarks

  • Table.ReorderColumns is similar to Record.ReorderFields applied to every row in a table.

  • Columns that are not specified will remain in the same location and the specified columns will be ordered around them.

Examples

Table.ReorderColumns(Table.FromRecords({[CustomerID=1, Phone = "123-4567", Name ="Bob"] }), {"Name","Phone"})  
CustomerIDNamePhone
1Bob123-4567
CustomerIDNamePhone
1Bob123-4567
Table.ReorderColumns(Table.FromRecords({  
  
    [CustomerID=1, Name = "Bob", Phone = "123-4567"]  
  
}), {"Address1", "Address2"}, MissingField.UseNull)  
  
Table.ReorderColumns(Table.FromRecords({  
  
    [CustomerID=1, Name = "Bob", Phone = "123-4567"]  
  
}), {"Address1", "Address2"}, MissingField.UseNull)  
CustomerIDNamePhone
ddress1Address2
1Bob123-4567nullnull
© 2018 Microsoft