Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys. I've trying to find a way to separate a part of a text, but I cant find. I have a random sentence that it has a word I want. This word allways have the pattern: letter-letter-number-letter, Examples: 13A7, 25E9, 63B8...
This are an example of text from where I want to extract:
Text column: "The product 8361529 with batch code 13A7 have the issue number 24865"
Return column: "13A7"
Please imagine this in power query.
Thank you guys and sorry for my bad english.
Solved! Go to Solution.
You can paste this to new blank query and adjust to your query.
2nd step looks for all words of length 4, containing 3 digits with letter on 3rd position.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslIVSgoyk8pTS5RsDA2MzQ1slQwBQKF8sySDIWkxJLkDIXk/JRUBUNjR3OFjMSyVIUSoJbM4uLSVIW80tyk1CIFIxMLM1OlWB3spqEbZGLpSh2DTE3dzahikKGhjylVDDI2C7CkThgZhZpQxSADg0gL/AbFAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Text = _t]),
#"Added Custom" = Table.AddColumn(Source, "Return", each List.Select( Text.Split ( [Text], " "), each Text.Length(_)=4 and Text.Length( Text.Select(_,{"0".."9"}))=3 and List.Contains({"A".."Z"},Text.ToList(_){2}) ) ),
#"Expanded Return" = Table.ExpandListColumn(#"Added Custom", "Return")
in
#"Expanded Return"
Result:
You can paste this to new blank query and adjust to your query.
2nd step looks for all words of length 4, containing 3 digits with letter on 3rd position.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCslIVSgoyk8pTS5RsDA2MzQ1slQwBQKF8sySDIWkxJLkDIXk/JRUBUNjR3OFjMSyVIUSoJbM4uLSVIW80tyk1CIFIxMLM1OlWB3spqEbZGLpSh2DTE3dzahikKGhjylVDDI2C7CkThgZhZpQxSADg0gL/AbFAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Text = _t]),
#"Added Custom" = Table.AddColumn(Source, "Return", each List.Select( Text.Split ( [Text], " "), each Text.Length(_)=4 and Text.Length( Text.Select(_,{"0".."9"}))=3 and List.Contains({"A".."Z"},Text.ToList(_){2}) ) ),
#"Expanded Return" = Table.ExpandListColumn(#"Added Custom", "Return")
in
#"Expanded Return"
Result:
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
6 | |
6 | |
6 |