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
Bebo
Helper II
Helper II

Replace Value in One Column based upon condition in another Column

I am trying to create a dax expression that will replace the value in one column based upon a condition in another column. For instance, in the following table, if the "gamecode=1" in Type Column), replace "1" in TypeID column with "Game 1".

Any suggestions?

 

Type

Type ID

gamecode

0

gamecode

1

sensor state

1

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Bebo,

You can create a calculated column with SUBSTITUTE function to repalce values based on other column values:

Replaced =
IF (
    Table[Type] = "gamecode",
    SUBSTITUTE ( Table[Type], "code", Table[Type ID] )
)

Regards,

Xiaoxin Sheng

View solution in original post

Thank you - worked perfectly.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Bebo with DAX you cannot replace the value but you can add another conditional column

 

New Type Column = 
IF ( Table[Type] = "GameCode", "Game 1", "Else Value" )

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks you for the quick response.

 

I could not get that to work. What I am trying to is this:

If Column Type = "game code" AND Column TypeID = "1", Output in conditional column would be "Game 1". Then I would repeat this for other TypeID numbers.

Anonymous
Not applicable

Hi @Bebo,

You can create a calculated column with SUBSTITUTE function to repalce values based on other column values:

Replaced =
IF (
    Table[Type] = "gamecode",
    SUBSTITUTE ( Table[Type], "code", Table[Type ID] )
)

Regards,

Xiaoxin Sheng

Thank you - worked perfectly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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