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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Replace/Substitute text in specific column using DAX

I need to replace a text in a specific column, but as my report comes from a cube, I cannot manipulate the data using Power Query or Add Columns, the only option I have is to create a measure using DAX.

 

I did a research and I could use Replace or Substitute, but I'm still not quite sure how to replace a text every time it appears in the column. Below is an example in excel of what I'm looking for to do in PBI. In this example, I need to substitute/replace Apple for Pear.

 
Original NamesNEW Names
ApplePear
BananaBanana
StrawberryStrawberry
ApplePear
BananaBanana
StrawberryStrawberry
StrawberryStrawberry
StrawberryStrawberry
BananaBanana
BananaBanana
ApplePear
BananaBanana
ApplePear
ApplePear
StrawberryStrawberry
ApplePear
BananaBanana
StrawberryStrawberry
StrawberryStrawberry
StrawberryStrawberry
BananaBanana
BananaBanana
 

I appreciate any help. Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Whenever your source is live connection you can create only measure from power BI side.

 

For your requirement it's better replace values at cube side on existing column or by creating new column.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello,

 

Yes, you could use the SUBSTITUTE function but it appears that it only allows one string at a time. If you're facing an issue where you need to replace the string value of multiple rows, I don't think this would work.


What I would do would be to use the SWITCH() and SELECTEDVALUE() functions. Unfortunately it's a very manual solution but if you don't have 100s of words to replace, this could be an effective solution without needing to change the underlying data values.

For example:

NEW Names =
VAR SelectedName = SELECTEDVALUE([Original Name]) //This returns the selected value from original name in the table visual.
RETURN
SWITCH( SelectedName,  //This evaluates true if the 2nd argument is ==, else it evaluates false and continues through the switch
    "Apple", "Pear", 
    "Raspberry", "Blueberry",
    "Cherry", "Watermelon",
    "SelectedName"  //This simply returns the selected name if the name doesn't equal the values listed above
)

Anonymous
Not applicable

Thanks for the reply. I tried it but unfortunately, it didn't work. I guess I need to change in the cube.

Anonymous
Not applicable

Whenever your source is live connection you can create only measure from power BI side.

 

For your requirement it's better replace values at cube side on existing column or by creating new column.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Anonymous
Not applicable

Thanks for the reply. I need to change it in the cube indeed.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.