cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bkan
Responsive Resident
Responsive Resident

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

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

Hi @bkan

 

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!

alekhved
Resolver I
Resolver I

hi @bkan 

 

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

bkan
Responsive Resident
Responsive Resident

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

Thanks

amitchandak
Super User IV
Super User IV

@bkan , You want replace or substitute ?

https://docs.microsoft.com/en-us/dax/substitute-function-dax



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

bkan
Responsive Resident
Responsive Resident

@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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Top Solution Authors
Top Kudoed Authors