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 column name as previous column first value

Hi there!

 

Is there a way to accomplish the following:

A123Chauhan_0-1645094527336.png

 

I'll always have one row in this form. I want the 3rd column to be renamed as the value of previous column and then deleting the second column automatically so that output table should look like below:

 

A123Chauhan_1-1645094773826.png

 

I have number of files for which I need to apply this. Can anyone help me with this ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You can copy below code and paste it in Advanced Editor.

 

...   
... ,
 #"Renamed Columns" = 
    let _Name = List.Max(#"Merged Queries"[Table.Name]) in
    Table.RenameColumns(#"Merged Queries",{{"Table.Table", _Name}}),
    #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Table.Name"})
    
in
    #"Removed Columns"

 

Pay attention to #"Merged Queries" in my code, this the step above "Renamed Columns" step, so you need to change it in your code. The logic of this code is to get max value in "Table.Name" column. Due to you only have one row so the max value is the name we need. Then use it to rename "Table.Table" column. Finally remove "Table.Name" column.

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

You can copy below code and paste it in Advanced Editor.

 

...   
... ,
 #"Renamed Columns" = 
    let _Name = List.Max(#"Merged Queries"[Table.Name]) in
    Table.RenameColumns(#"Merged Queries",{{"Table.Table", _Name}}),
    #"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Table.Name"})
    
in
    #"Removed Columns"

 

Pay attention to #"Merged Queries" in my code, this the step above "Renamed Columns" step, so you need to change it in your code. The logic of this code is to get max value in "Table.Name" column. Due to you only have one row so the max value is the name we need. Then use it to rename "Table.Table" column. Finally remove "Table.Name" column.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Thank you so much for your response @Anonymous 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.