The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Dear Community Members
I have a below use case where I want to remove any substring separated with a space and has only letters in it. Please see the Output column below. Is this something achievable in Power query or dax in Powerbi? The problem is the substring with just alphabets can be of any length and placed anywhere in the String column.
Thank You!
String | Output |
123/4F01 abc/def 346 54789/6201 | 123/4F01 346 54789/6201 |
wqs/def 123/4F01 346 54789/6201 | 123/4F01 346 54789/6201 |
123/4F01 346 abc/def 54789/6201 | 123/4F01 346 54789/6201 |
123/4F01 346 54789/6201 abc/def | 123/4F01 346 54789/6201 |
Solved! Go to Solution.
hi, @Shobs15 , please try to use the following M code:
Table.AddColumn(#"Previous Step", "Cleaned Output", each
Text.Trim(
Text.Combine(
List.Select(Text.Split([String], " "),
each Text.Contains(_,"0") or Text.Contains(_,"1") or Text.Contains(_,"2") or Text.Contains(_,"3") or
Text.Contains(_,"4") or Text.Contains(_,"5") or Text.Contains(_,"6") or Text.Contains(_,"7") or
Text.Contains(_,"8") or Text.Contains(_,"9")
), " "
)
))
Note: Make sure to replace [String] with your own field.
hi, @Shobs15 , please try to use the following M code:
Table.AddColumn(#"Previous Step", "Cleaned Output", each
Text.Trim(
Text.Combine(
List.Select(Text.Split([String], " "),
each Text.Contains(_,"0") or Text.Contains(_,"1") or Text.Contains(_,"2") or Text.Contains(_,"3") or
Text.Contains(_,"4") or Text.Contains(_,"5") or Text.Contains(_,"6") or Text.Contains(_,"7") or
Text.Contains(_,"8") or Text.Contains(_,"9")
), " "
)
))
Note: Make sure to replace [String] with your own field.
User | Count |
---|---|
77 | |
77 | |
36 | |
30 | |
28 |
User | Count |
---|---|
106 | |
97 | |
55 | |
49 | |
46 |