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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi Power BI community! Newby here, and I need help!
I've got a direct query project started and I need to replace a component of text in one column if conditions are met from another column.
Example. If column1 is Alberta OR British Columbia, a portion of Column 2 string needs to change: from C1 to C2. I need the rest of string to stay the same.
Before:
Column 1 | Column 2 |
Alberta | C1Triangle |
Alberta | C1Circle |
Quebec | C1Circle |
British Columbia | C1Square |
Newfoundland | C2Circle |
After:
Column 1 | Column 2 |
Alberta | C2Triangle |
Alberta | C2Circle |
Quebec | C1Circle |
British Columbia | C2Square |
Newfoundland | C2Circle |
Thank you!!!
Solved! Go to Solution.
Hello @Simonne ,
I prefer to choose Power Query transformations for best practice. So transform data(power query) --> Add column --> Custom Column:
if [Column]="Alberta" or [Column]="Columbia" then Text.Replace([Column],"C1","C2") else [Column]
Kind Regards,
Gökberk Uzuntaş
📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!
🔗 Stay Connected:
📘 Medium |
📺 YouTube |
💼 LinkedIn |
📷 Instagram |
🐦 X |
👽 Reddit |
🌐 Website |
🎵 TikTok |
Ok I got it! Thank you both!!!
Hello @Simonne ,
I prefer to choose Power Query transformations for best practice. So transform data(power query) --> Add column --> Custom Column:
if [Column]="Alberta" or [Column]="Columbia" then Text.Replace([Column],"C1","C2") else [Column]
Kind Regards,
Gökberk Uzuntaş
📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!
🔗 Stay Connected:
📘 Medium |
📺 YouTube |
💼 LinkedIn |
📷 Instagram |
🐦 X |
👽 Reddit |
🌐 Website |
🎵 TikTok |
Perfect, it worked thank you!!
Hi @Simonne
You can create a new column by using this DAX:
Upd_Column2 =
IF(
'Table'[Column1] = "Alberta" || 'Table'[Column1] = "British Columbia",
SUBSTITUTE('Table'[Column2], "C1", "C2"),
'Table'[Column2]
)
Best Regards,
Muhammad Yousaf
If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly.
Thanks @muhammad_786_1 !
I tried using add custom column in queries.. is that wrong?
Here's what I see:
Hi @Simonne
You just need to select Table View, then select New Column, and paste the DAX formula there. This will create a new calculated column.
However, if you prefer using Power Query, you can achieve the same result by adding a Custom Column directly in the Power Query Editor.
Best Regards,
Muhammad Yousaf
If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.