Forum Discussion
Conditional Split Column by delimiter based on value
- Anonymous6 years ago
The solution I used was to Extract Text Between Delimeters:
Under Add Columns in Query Editor, Extract - Text Between Delimiters - and I entered the text string before and after the value I wanted to extract.
This will only work if the text string is consistent.
Hi Anonymous
Please try below M code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMnIP9XQxVorViVbyTc1NSi1SgHGxSMDFY0oNDIzMUMWNMJVBxI1BUCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1], "GUID") then "GUID" else if Text.Contains([Column1], "Member ID") then "Member ID" else null)
in
#"Added Conditional Column"
- Anonymous6 years agoNot applicable
Hi v-diye-msft
I think your code is just extracting the word GUID and Member ID. I actually want the text that appears after these words, so if text contains "GUID" then I want the actual ID number that appears after it.
Fortunately, the GUID or Member ID appear at the end of the API string.
- mussaenda6 years agoCommunity Champion
Hi Anonymous ,
can you provide a sample data and your expected output so we can text and help you easier.
Thank you
- v-diye-msft6 years agoCommunity Support
Hi Anonymous
Please give me some examples.
- Anonymous6 years agoNot applicable
It's ok I figured out how to do it myself!
Thanks anyway