Forum Discussion
Need Help with Replace Value
- Anonymous3 years ago
Hello Alice_Cooper
I used this method to create the custom table.
BULK Replace Values in Power BI / Power Query - YouTube
Basically it involves your main query table, seconday table (TranslationsTable), custom function.let Source = #table( type table [ OldText = text, NewText = text ], { {"SECURE", "999"}, {"D", "4"}, {"/", ""}, {"C", "3"} } ) in Source(x as text) as text => let maxIterations = Table.RowCount(TranslationTable), Iterations = List.Generate( () => [ Result = Text.Replace( x, TranslationTable[OldText]{0}, TranslationTable[NewText]{0} ), Counter = 0 ], each [Counter] < maxIterations, each [ Result = Text.Replace( [Result], TranslationTable[OldText]{Counter}, TranslationTable[NewText]{Counter} ), Counter = [Counter] + 1 ], each [Result] ), output = Iterations{maxIterations - 1} in output
This method/approach will help you resolve your query.
Also, please view the video if possible to understand better.
Thank youu.
If my answer helps you, please mark it as solution.
Hi Alice_Cooper ,
Does this video help you?
Replace multiple values in Power Query in one step - YouTube
Leet me know! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Not quite ...
I have a list
Column1 NewCoulmn What I want to do
C1-343 31343 <- I look for C and Replace with 3 and replace - with ""
23/45 2345 <- I look for ? and replace with ""
SECURE 999 <- I look for SECURE and replace with 999
34D23 34423 <- I look for D and replace with 4
In essence I want to be able to look for an individual charcter or group of chracters in the string and replace these with another set of characters ... in this case a number or ""...
- tackytechtom3 years agoMost Valuable Professional
Ah, I see!
I think this should be doable with a function. Check out this one here as an inspiration:
replace multiple characters in column power query m - Google Suche
Does this help?
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/