Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 65 | |
| 43 | |
| 41 | |
| 33 | |
| 23 |
| User | Count |
|---|---|
| 199 | |
| 124 | |
| 104 | |
| 74 | |
| 55 |