February 1, 2019
Hello Guys,
i have table :
And now i am building Table1 query where i want to add additional custom - concatenated columns based on ListOfTables table.
As you can see concatenation column (Key) is made only from Col1&Col2&Col3 because in ListOfTables table there is no more Concatenated colums listed for the specific table.
How to build dynamic solution for the issue?
It would be nice to create a dynamic list based on Table name from ListOfTables and matching columns from used table, in our example Table1.
In Other words,
How to dynamically add Key column concatenated with columns listed in ListOfTables into specific query?
Please help,
Jacek
July 16, 2010
Hi Jacek,
I think the problem with the example is that the data in the columns is the same as the column headers. It's also not clear whether you want to refer to column numbers or real column names because the example uses column names with numbers.
Perhaps some more realistic example data will help us infer what you really want. It would also be good to have some background information on why you want to do this as the solution you're requesting might not be the most efficient.
Mynda
February 1, 2019
Hi Guys,
thank you.
All what i need is to refer to column names and use them dynamically in concatenation column.
So instead of writing manually string in concatenated formula: "=[Col1] & "-" & [Col2] & "-" & [Col3]" i want to create list of column names dynamically and use the list in concatenated formula to not do this manually.
I hope it is clear now.
So how to provide dynamic list from table header names in order to use them in a list in concatenated formula syntax?
please ask if something is not understandable.
Best,
Jacek
Trusted Members
Moderators
November 1, 2018
I'd imagine this can be simplified, but it's been a long day!
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Col1", type text}, {"Col2", type text}, {"Col3", type text}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type", "TableName", each "Table1"),
#"Merged Queries" = Table.NestedJoin(#"Added Custom1",{"TableName"},ListOfTables,{"TableName"},"ListOfTables",JoinKind.LeftOuter),
#"Added Custom" = Table.AddColumn(#"Merged Queries", "Key", each Table.ToList(Table.SelectColumns([ListOfTables], {"ColumnsToConcatenate"}))),
#"Added Custom2" = Table.AddColumn(#"Added Custom", "Custom", each Text.Combine(Record.FieldValues(Record.SelectFields(_, [Key])), ","))
in
#"Added Custom2"
Answers Post
1 Guest(s)