Combiner.CombineTextByDelimiter
Makes a function that joins a list of texts into one, with a separator between them.
Group: Splitters, combiners, replacers and comparers. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Combiner.CombineTextByDelimiter(delimiter as text, optional quoteStyle as nullable number) as function
| Parameter | Type | Description |
|---|---|---|
delimiter | text | What goes between the texts; "" joins them with nothing between. |
quoteStyle | nullable number optional | QuoteStyle.Csv (the default) puts double quotes around any piece with the separator, a double quote or a line break in it; QuoteStyle.None joins the texts as they are. |
Returns
function. A combiner: given a list of texts, one text.
Remarks
Table.CombineColumnstakes a combiner to merge columns into one, as Merge Columns does.- The items must be text: turn numbers into text first, with
Text.FromorNumber.ToText. A null joins as an empty text, separators and all.
Examples
Shops in a sentence
Combiner.CombineTextByDelimiter(", ")({"Oslo", "Bergen", "Trondheim"})
"Oslo, Bergen, Trondheim"
Merge two columns into an address
let
Shops = #table({"Street", "City"}, {{"Storgata 1", "Oslo"}, {"Bryggen 5", "Bergen"}})
in
Table.CombineColumns(Shops, {"Street", "City"}, Combiner.CombineTextByDelimiter(", "), "Address")
| Address |
|---|
| Storgata 1, Oslo |
| Bryggen 5, Bergen |
A name that holds the separator
Combiner.CombineTextByDelimiter(",")({"Hansen, Kari", "Oslo"})
"""Hansen, Kari"",Oslo"
Quoted, so that splitting the text again gives the two values back.
Related functions
Text.Combine, Table.CombineColumns, Splitter.SplitTextByDelimiter.