Forum Discussion
gadao
4 years agoFrequent Visitor
Compare Column Names from Multiple Sources
Hi there, I was wondering if someone could give me some ideas in creating a matching col names table. The ideia is simple, but i can't figure out. This table would have n columns, each co...
dufoq3
Community Champion
1 year agoHi gadao, another solution:
You have to define your tables here:
Output:
You can delete steps Table1 - Table4 (they are just as sample tables).
let
Table1 = #table(Text.ToList("ABCEFH"), {}),
Table2 = #table(Text.ToList("AHD"), {}),
Table3 = #table(Text.ToList("HGABD"), {}),
Table4 = #table(Text.ToList("GAC"), {}),
DefineTablesHere = [ //I do not know your table names, but you have to specify all of them here.
Table1 = Table1,
Table2 = Table2,
Table3 = Table3,
Table4 = Table4
],
TablesColNames = List.Transform(Record.ToList(DefineTablesHere), Table.ColumnNames),
AllColNames = List.Buffer(List.Sort(List.Distinct(List.Combine(TablesColNames)))),
TableMap = Table.FromColumns(List.Transform(TablesColNames, each List.Transform(AllColNames, (x)=> if List.Contains(_, x) then x else null)), Record.FieldNames(DefineTablesHere))
in
TableMap