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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to replace multiple string values

Hi All,

I have the following REPLACE function , which works fine, but my column has different values, for example the other value is "Bagels for Life", how can i change both or more values using REPLACE? Please advice.

DEFINE
VAR Val = "Donuts for Life"
VAR Replacement = "DFL"
EVALUATE
{
( "Original", Val ),
( "Replaced", REPLACE ( Val, 1, 15, Replacement ) )
}

Thanks

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

You can create a custom column as:

Text.Select([Column1],{"A","B","C","D","E","F","L"})

vxulinmstf_1-1627279888098.png

You need to add all relevant capital letters in the red underlined part, you can also just add 'A-Z'.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

5 REPLIES 5
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

You can create a custom column as:

Text.Select([Column1],{"A","B","C","D","E","F","L"})

vxulinmstf_1-1627279888098.png

You need to add all relevant capital letters in the red underlined part, you can also just add 'A-Z'.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

Anonymous
Not applicable

hi @Anonymous 

 

Are the values such as "Donuts for Life" par of a larger string "Donuts for Life is Good"? If Not, then can we add custom column in power query and replace the values?

 

alekhved_0-1627062484711.png

 

 

Thanks,

alekh

Anonymous
Not applicable

Any idea if i can replace multiple values in a column? Please.

Thanks

amitchandak
Super User
Super User

Anonymous
Not applicable

@amitchandak thanks , all i want is where ever in my column is see values  "Donuts for Life", "Bagels for Life" , "Fries for Life", need to see DFL,BFL,FLF respectively. I do not know if using REPLACE or SUBSTITUTE is good.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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