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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LiyaZhao
Frequent Visitor

Rename multiple column names along with split words

I have a table imported into Power Query editor. The columns have the following names:

accountid| accountcode| customersizecode| preferredcontact

--------------------------------------------------------------------

1234        | wdkdf           | abdef                     | dksdmsd

1092        | kjfgfkf           | hghg                      |opwkffkd

1342        | isivmw          | wlslvs                      | wyywcga

 I am trying to rename the columns with splited words to it's corresponding phrase. e.g. :
Account Id | Account Code | Customersize Code | Preferred Contact ....

 

I tried 

 Table.TransformColumnNames

 but it doesn't work.

 

Any idea on split the word?

Thanks!

@ImkeF

2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

Oops.  Over thought it.  You will need to hardcode it manually, I think.  Just double click on each column header and type in the desired column name.  This should result in a single step that renames multiple columns.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

v-yingjl
Community Support
Community Support

Hi @LiyaZhao ,

Seems that you have not specific split definition for multiple columns like "_", " " etc. so the directly way to rename columns is that renaming them manually which is like @ mahoneypat mentioend.

If your columns have the same split defintion, you can follow this similar issue to rename them:

Rename multiple column names along with changing their column numbers to Letters 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yingjl
Community Support
Community Support

Hi @LiyaZhao ,

Seems that you have not specific split definition for multiple columns like "_", " " etc. so the directly way to rename columns is that renaming them manually which is like @ mahoneypat mentioend.

If your columns have the same split defintion, you can follow this similar issue to rename them:

Rename multiple column names along with changing their column numbers to Letters 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

Oops.  Over thought it.  You will need to hardcode it manually, I think.  Just double click on each column header and type in the desired column name.  This should result in a single step that renames multiple columns.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Employee
Employee

Not sure what your input data looks like.  Hopefully you could split your columns by "|" to avoid having to remove it.  If not, a step with this formula with will remove "|" from all column names.  You can rename one column to generate most of the code needed, and then copy/paste the List.Zip part over the same part of that.

 

= Table.RenameColumns(#"Changed Type", List.Zip({Table.ColumnNames(#"Changed Type"), List.Transform(Table.ColumnNames(#"Changed Type"), each Text.Replace(_, "|",""))}))

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks for the anwering!  "|" just mean different columns, LOL. What I really want is to rename multiple columns name from "accountid" to "Account ID", "accountcode" to "Account Code"...

The hard part is there is no delimiter to split the text. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors