Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Rename some columns by adding a prefix

Hi everyone.

I have some tables with aprox. 40 columns. I would like to rename some of these columns by adding a prefix. I have tried Table.PrefixColumns but this adds a prefix to all the columns. Is there a way to achieve this only in some columns?

 

Thanks a lot

 

1 ACCEPTED SOLUTION

Thanks for the additional info. 

See attached PBIX.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Guys, you are awesome. 

ronrsnfld
Super User
Super User

  1. Create a list of the columns you want to prefix
  2.  List.Transform => create a "Rename List".
  3.  Table.RenameColumns

Code Example:

let
    tbl = Table.FromColumns(
        {{"a","B","C","D","E"},
        {"F","G","H","I","J"},
        {"K","L","M","N","O","P"},
        {"Q","R","S","T","U"},
        {"F","G","H","I","J"},
        {"K","L","M","N","O","P"}}
        ),
   
    #"Columns to Prefix" = {"Column2", "Column4", "Column6"},
    Prefix = "Old.",
    Renames = List.Transform(#"Columns to Prefix", each {_, Prefix & _}),

    #"Prefix Some" = Table.RenameColumns(tbl, Renames)
in 
    #"Prefix Some"

Before

ronrsnfld_0-1658190134152.png

 

After

ronrsnfld_1-1658190165018.png

 

 

KNP
Super User
Super User

Probably, which columns?

Please provide sample data.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!
Anonymous
Not applicable

Hi, basically I want to achieve this:

All columns but ITEM, get the prefix "CANT" in their nameAll columns but ITEM, get the prefix "CANT" in their name

With that information, you can modify what I wrote by creating the list appropriately by changing two lines:  (replace "tbl" with the appropriate table reference

#"Columns to Prefix" = List.RemoveMatchingItems(Table.ColumnNames(tbl),{"ITEM"}),
Prefix = "CANT",

 

Thanks for the additional info. 

See attached PBIX.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
xOIEmaj

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
image
fabric-SUbadge
Proud to be a Super User!
Anonymous
Not applicable

Thank you. It worked really good.

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors