Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all
I need to extract some specific text from a string to be used as a future reference, problem is due the received data not being very consistant, I've tried using the extract funtion in power query but the result is still too varied as the below suggests.
Extract after gives to much info behind the delimiter, which is br.
Extract between 'br' and ' ' (space) or 2nd ' ' (space) also provides unnecessary results but includes some ommited results.
Ideally I would need either a DAX formula or other solution to get to either the expected result or ideal result shown in the example... problem is I don't even know where to start with this.
Any assistance would be greatly appreciated.
From your example, it appears that the pattern you are looking for is a substring that
That being the case, you could either use Regular Expressions (using Python, R or Java in Power BI/Power Query)
or try the following which uses native M functions to match that pattern.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("JYwxDsIwDAC/YmWmEqgUXsDGBGOUwcUuMpQYHEeivwfCeHfSxRiOjHe8MkxaM4FkuKlkD2kVw8FMDS5KDKNBvx6aPS/F+QHc4mib/q8nrLN/udvud0BSnjMuTC2d+FXFfhMUAn47ZxfNJaT0AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Problem Description" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Problem Description", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Extract", each
let
after= Splitter.SplitTextByCharacterTransition({"0".."9"},(c)=>not List.Contains({"0".."9"},c))
(Text.AfterDelimiter([Problem Description],"br")){0}
in
if List.Contains({"0".."9"}, Text.End(after,1))
then "br" & after
else null,
type nullable text)
in
#"Added Custom"
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |