Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Is there a way to make Text.Combine() use an incrementing delimiter?
For example, change the "||" below to an incrementing number that starts from 1?
{"NamesColumn (Combined)", each Text.Combine([#"NamesColumn"]," || "), type text}
So instead of a result like:
Betty || Mark || John || Alice
I'd like something like:
(1) Betty (2) Mark (3) John (4) Alice
Solved! Go to Solution.
Hi @wad11656 ,
yes, this can be done with the List.Zip-function:
let
Source = {"Betty", "Mark", "John", "Alice"},
ListWithNumbers = {1 .. List.Count(Source)},
FormattedListWithNumbers = List.Transform(ListWithNumbers, each "(" & Text.From(_) & ") "),
ZipAndExpand = List.Combine(List.Zip({FormattedListWithNumbers, Source})),
ToText = Text.Combine(ZipAndExpand, " ")
in
ToText
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Or if you prefer a solution that does more in table-mode, you could use this:
let
Source = {"Betty", "Mark", "John", "Alice"},
#"Converted to Table" = Table.FromList(
Source,
Splitter.SplitByNothing(),
null,
null,
ExtraValues.Error
),
#"Added Index" = Table.AddIndexColumn(#"Converted to Table", "Index", 1, 1, Int64.Type),
#"Reordered Columns" = Table.ReorderColumns(#"Added Index", {"Index", "Column1"}),
Custom1 = #"Reordered Columns",
AddBrackets = Table.TransformColumns(
Table.TransformColumnTypes(Custom1, {{"Index", type text}}, "en-US"),
{{"Index", each "(" & _ & ")", type text}}
),
Custom2 = AddBrackets,
Custom3 = List.Combine(Table.ToRows(Custom2)),
Custom4 = Text.Combine(Custom3, " ")
in
Custom4
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @wad11656 ,
yes, this can be done with the List.Zip-function:
let
Source = {"Betty", "Mark", "John", "Alice"},
ListWithNumbers = {1 .. List.Count(Source)},
FormattedListWithNumbers = List.Transform(ListWithNumbers, each "(" & Text.From(_) & ") "),
ZipAndExpand = List.Combine(List.Zip({FormattedListWithNumbers, Source})),
ToText = Text.Combine(ZipAndExpand, " ")
in
ToText
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries