Forum Discussion
JustDavid
Helper V
11 months agoDynamically combine Headers from each table
PQ Gurus, Apologies in advanced that I can't share sample pbix file as i don't know how to create a "table" in each row. Hopefully my screenshot can show you and that you're able to understan...
- 11 months ago
This might work for you...
let Source = #table( type table [Name=nullable text, Data = table], { {"File1", #table({"Column1", "Column2"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})}, {"File2", #table({"Column1", "Column3"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})}, {"File3", #table({"Column2", "Column4"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})} } ), Add_Header_Names_List = Table.AddColumn(Source, "HeaderNames", each Table.ColumnNames([Data]), type list), Get_Distinct_Header_Names = List.Distinct(List.Combine(Add_Header_Names_List[HeaderNames])) in Get_Distinct_Header_Names
jgeddes
Super User
11 months agoThis might work for you...
let
Source =
#table(
type table [Name=nullable text, Data = table],
{
{"File1", #table({"Column1", "Column2"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})},
{"File2", #table({"Column1", "Column3"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})},
{"File3", #table({"Column2", "Column4"},{{"R1C1", "R1C2"},{"R2C1", "R2C2"}})}
}
),
Add_Header_Names_List = Table.AddColumn(Source, "HeaderNames", each Table.ColumnNames([Data]), type list),
Get_Distinct_Header_Names = List.Distinct(List.Combine(Add_Header_Names_List[HeaderNames]))
in
Get_Distinct_Header_Names