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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Homaa
Frequent Visitor

How to rename a duplicated value in a column?

there is a table that has two columns (id, name). there is a value in "name" column as "ABC Kitchen" which has two separate _ids but the same name. I want to change the name for the one that _id is "12345" to "ABC Kitchen (old)".
I tried to add a step to replace value

 

= Table.ReplaceValue(#"PreviousStepName", "ABC Kitchen (old)", each if [id] = "12345" then "ABC Kitchen (old)" else [name], Replacer.ReplaceText,{"name"})

 

but it didn't change the name. I also tried this

 

= Table.TransformColumns(#"PreviousStepName", {{"name", each if [id] = "12345" then "ABC Kitchen (old)" else _, Text.Type}})

 

but this time, I got error for all values in the column. Do you have any suggestion for me?

1 ACCEPTED SOLUTION
mlsx4
Memorable Member
Memorable Member

@Homaa 

Then, change the sentence by this one. It was my fault when writing it:

 

 

= Table.ReplaceValue(PreviousStepName,each [Name], each if [ID]="12345" then "ABC Kitchen (Old)" else [Name] ,Replacer.ReplaceText,{"Name"})

 

View solution in original post

4 REPLIES 4
Homaa
Frequent Visitor

Thank you but the problem here is that there are other values in the "name" column as well. So, [ID] <> "12345" is not working. the type for both column is text

mlsx4
Memorable Member
Memorable Member

@Homaa 

Then, change the sentence by this one. It was my fault when writing it:

 

 

= Table.ReplaceValue(PreviousStepName,each [Name], each if [ID]="12345" then "ABC Kitchen (Old)" else [Name] ,Replacer.ReplaceText,{"Name"})

 

Homaa
Frequent Visitor

it works. Thank you!

mlsx4
Memorable Member
Memorable Member

Hi @Homaa 

= Table.ReplaceValue(PreviousStepName,each [Name], each if [ID]<>"12345" then "ABC Kitchen" else "ABC Kitchen (Old)",Replacer.ReplaceText,{"Name"})

Be careful with the type of data for the column id too.  Because if it is number, you should compare without "" characters

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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