March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I am doing some text clean up work and want to dynamically delete all words with up to 3 characters. I have therefore created a dynamic list of words with more than 3 characters.
However I cannot replace it with that list using the replace button in power query. Does anyone have an idea?
Solved! Go to Solution.
See below a potential solution
Table.TransformColumns( #"name of previous step", { "columnName", each let vTextSplit = Text.Split(_, " "), vListSelect = List.Select(vTextSplit, each Text.Length(_) >3), vResult = Text.Combine(vListSelect, " ") in vResult, type text } )
Let us know if that works for you.
David
Thank you guys.
The think is there are mutliple words in one cell. So I have a text as follows "the way can be good for business" I want it to return "good business" only.
@raymond if you want the result in a different column, then use the following
Table.AddColumn( #"name of previous step", "newColumnName", each let vTextSplit = Text.Split([columnName], " "), vListSelect = List.Select(vTextSplit, each Text.Length(_) >3), vResult = Text.Combine(vListSelect, " ") in vResult, type text )
See below a potential solution
Table.TransformColumns( #"name of previous step", { "columnName", each let vTextSplit = Text.Split(_, " "), vListSelect = List.Select(vTextSplit, each Text.Length(_) >3), vResult = Text.Combine(vListSelect, " ") in vResult, type text } )
Let us know if that works for you.
David
@raymond I think you could adjust the M code with something as follow in the column where you want to get rid of your "3 characters" text:
Table.TransformColumns( #"name of previous step", { "columnName", each if Text.Length(_) <= 3 then "" else _ } )
Let us know if that works for you
David
Hi @raymond
Do you want to keep words with more than 3 chars or remove them? Your problem title and the question text say different things.
You can use a step like this to keep rows where [ColumName] contains words with 3 or fewer characters
= Table.SelectRows(#"PreviousStep", each Text.Length([ColumnName]) <= 3)
But if this isn't what you want, please post some sample data and examples of your expected result.
Regards
Phil
Proud to be a Super User!
Thanks @PhilipTreacy
you are right, could be more specific.
The sample data is as follows:
Original Column A includes:
"the way can be good for business"
Expected Column B should result:
"good business"
Delete all words with less than 3 characters and keep the ones with more.
I was thinking of you a replacer can iterate through a list of values and replaces them but wasnt able to find it. Perhaps there is another solution.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |