'How to Extract the Text between the delimiters in Power BI Query
Solution 1:[1]
This works in powerquery (M)
It assumes data is coming from Table1, into Column 1 Adjust code if that is not true
It also assumes there is a space between the ending ~ and the next word
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Replaced Value" = Table.ReplaceValue(Source,"~ ","::",Replacer.ReplaceText,{"Column1"}),
#"Adjust edge case" = Table.TransformColumns(#"Replaced Value",{{"Column1", each if Text.End(_,1)="~" then Text.Start(_,Text.Length(_)-1) &"::" else _, type text}}),
#"Added Custom" = Table.AddColumn(#"Adjust edge case", "Custom", each List.Difference(List.Transform(Text.Split([Column1],"~"), each Text.BeforeDelimiter(_,"::")),{""})),
ColumnNames=List.Transform({1..List.Max(List.Transform(#"Added Custom"[Custom], each List.Count(_)))}, each "Data "&Text.From(_)),
#"Added Custom2" = Table.AddColumn(#"Adjust edge case", "Custom", each Text.Combine(List.Skip(List.Transform(Text.Split([Column1],"~"), each Text.BeforeDelimiter(_,"::")),1),"~")),
#"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom2", "Custom", Splitter.SplitTextByDelimiter("~", QuoteStyle.Csv), ColumnNames)
in #"Split Column by Delimiter"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |



