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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
A little tricky Subject Headline... Since im quite new to the Power BI game. I'd like to know if there is a way to rename contents of for example column "b" if a certain content in column "a" exists. Somehow i dont find a fitting solution with the Query Editor.
Solved! Go to Solution.
Yes, Table.Replace value is used for this. An example below
=Table.ReplaceValue(#"Changed Type",each [b],each if [a] ="abc" then "x" else [b],Replacer.ReplaceValue,{"b"})See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKk8tUtJRKihQitWJVkpMSgZyCgvBnPKSysoSILeoCEmuuFgpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
Custom1 = Table.ReplaceValue(#"Changed Type",each [b],each if [a] ="abc" then "x" else [b],Replacer.ReplaceValue,{"b"})
in
Custom1
Yes, Table.Replace value is used for this. An example below
=Table.ReplaceValue(#"Changed Type",each [b],each if [a] ="abc" then "x" else [b],Replacer.ReplaceValue,{"b"})See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKk8tUtJRKihQitWJVkpMSgZyCgvBnPKSysoSILeoCEmuuFgpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", type text}}),
Custom1 = Table.ReplaceValue(#"Changed Type",each [b],each if [a] ="abc" then "x" else [b],Replacer.ReplaceValue,{"b"})
in
Custom1
You can do it but you have to get into the Advanced Editor.
This code provides an example of one way to do this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKVtJRMlSK1YlWSklNA7KNwOz0jEwg2xjMzsrOAbJNlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"a", type text}, {"b", Int64.Type}}),
#"Look for in col A" = "ghi",
#"Conditional Rename" = if List.Contains(#"Changed Type"[a],#"Look for in col A")
then Table.RenameColumns(#"Changed Type",{"b","New Col Name"})
else #"Changed Type"
in
#"Conditional Rename"
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 10 | |
| 6 | |
| 5 | |
| 4 | |
| 2 |