Table.PrefixColumns

Updated on

Table.PrefixColumns is a Power Query M function that prefixes all column names in a table with a given text followed by a period. The function returns a new table with the updated column names.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Table.PrefixColumns(
   table as table,
   prefix as text,
) as table

Description

Table.PrefixColumns returns a table with all column names in the table prefixed with the given text, prefix, followed by a period.

Examples

Prefix the columns with “MyTable” in the table.

// Output: Table.FromRecords( {[MyTable.CustomerID = 1, MyTable.Name = "Bob", MyTable.Phone = "123-4567"]} )
Table.PrefixColumns( 
    Table.FromRecords( {[CustomerID = 1, Name = "Bob", Phone = "123-4567"]} ),
    "MyTable"
 )

Other functions related to Table.PrefixColumns are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-prefixcolumns