Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Here's a table with the results I seek:
col_1 | col_2 | result |
ape | bee | ape,bee |
house | street | house,street |
Now I have something like this (see below), where I collect each column that starts with "col_" (for up front I don't know how many columns there are) and use that information ('MyColumns') to create a custom column "result":
...
MyColumns = List.Buffer(List.Select(Table.ColumnNames(#"PreviousStep"), each Text.StartsWith(_, "col_"))),
#"Merged Columns" = Table.AddColumn(#"PreviousStep", "result", each Text.Combine(MyColumns, ";"), type text)
This results in "col_1,col_2", which is not what I need 😞
I hope someone can help. Thanks!
Solved! Go to Solution.
Try this as the next step:
= Table.AddColumn(#"Merged Columns", "Custom",
(r) => Text.Combine(List.Transform(MyColumns, each Record.Field(r, _)), ","),
type text)
This turns the list of columns into the values in those columns and concatenates the list with Text.Combine.
Try this as the next step:
= Table.AddColumn(#"Merged Columns", "Custom",
(r) => Text.Combine(List.Transform(MyColumns, each Record.Field(r, _)), ","),
type text)
This turns the list of columns into the values in those columns and concatenates the list with Text.Combine.
Wow Thanks it works perfectly !! Thank you mate!
Hi @AlexisOlson, thanks!
Do I understand correctly that (r) is a function referencing each record?
Yes. There's nothing special about the letter "r" but I needed to give it a name so that I could distinguish between the list environment and the row (record) environment when writing Record.Field(r, _).
Understood, thanks for the explanation!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
27 | |
12 | |
12 | |
11 | |
9 |
User | Count |
---|---|
53 | |
29 | |
17 | |
14 | |
13 |