Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hello
I am using the following custom function to replace the vlue in my table:
(data, replacements) =>
[
// generates a record with replacements
repl = Function.Invoke(Record.FromList, List.Reverse(Table.ToColumns(replacements))),
C = Table.TransformRows (
data,
(x) => Record.TransformFields (
x,
List.Transform (
Table.ColumnNames(data),
(name) => {name,(x) => Record.FieldOrDefault(repl,x,x)})) ),
result = Table.FromRecords(C)
][result]
Parameter replacements is similar to this:
Now I need to follow a similar approach on the Column Name.
How can I change the code above for this new target?
Thanks
Solved! Go to Solution.
Hi @Mic1979
If you're wanting a similar function to rename columns, you could use this:
(data, replacements) =>
// replacements is a two column table
// Column 1: old name
// Column 2: new name
[
replacementsList = Table.ToRows(replacements),
result = Table.RenameColumns(data,replacementsList,MissingField.Ignore)
][result]
Is this what you were looking for?
Hi @Mic1979
If you're wanting a similar function to rename columns, you could use this:
(data, replacements) =>
// replacements is a two column table
// Column 1: old name
// Column 2: new name
[
replacementsList = Table.ToRows(replacements),
result = Table.RenameColumns(data,replacementsList,MissingField.Ignore)
][result]
Is this what you were looking for?
It works. Many thanks
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.