Forum Discussion
Overlay Two Tabel
- 3 years ago
Hello - instead of looping through columns, I think it would be better to append the tables, unpivot, transform and repivot, like this:
let Source = Table.Combine({Table1, Table2}), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name", "Place"}, "Attribute", "Value"), #"Replaced Value" = Table.ReplaceValue(#"Unpivoted Other Columns","",null,Replacer.ReplaceValue,{"Value"}), #"Grouped Rows" = Table.Group(#"Replaced Value", {"Name", "Place", "Attribute"}, {{"Data", each _, type table [Name=nullable text, Place=nullable text, Attribute=text, Value=text]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if List.NonNullCount ( [Data][Value] ) > 1 then Text.Combine ( List.Sort ( [Data] [Value] ), " - " ) else List.RemoveNulls ( [Data][Value] ){0} ), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}), #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Custom") in #"Pivoted Column"Result
I do not want to do this same step 365 times, it is not going about to chacke if is date or not, I want to use List with colums.... something like this....
#"Aantal samengevoegd" = Table.AggregateTableColumn(#"Rijen gegroepeerd", "Aantal", {{"1-1-2023", List.Buffer, "Totaal van 1-1-2023"}, {"2-1-2023", List.Buffer, "Totaal van 2-1-2023"}}),
I need something like Table.AggregateTableColumn(#"Rijen gegroepeerd", "Aantal", each _ Column in ColumnList, List.Buffer, Column Name)
#"Uitgepakte waarden" = Table.TransformColumns(#"Aantal samengevoegd", {"Totaal van 1-1-2023", each Text.Combine(List.Transform(_, Text.From), " "), type text}),
#"Uitgepakte waarden1" = Table.TransformColumns(#"Uitgepakte waarden", {"Totaal van 2-1-2023", each Text.Combine(List.Transform(_, Text.From), " "), type text})
This one i need to do one time and not 365 times....
#"Uitgepakte waarden1" = Table.TransformColumns(#"Uitgepakte waarden", {each column, each Text.Combine(List.Transform(_, Text.From), " "), type text})
I'm not sure I do it good
Hello - instead of looping through columns, I think it would be better to append the tables, unpivot, transform and repivot, like this:
let
Source = Table.Combine({Table1, Table2}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name", "Place"}, "Attribute", "Value"),
#"Replaced Value" = Table.ReplaceValue(#"Unpivoted Other Columns","",null,Replacer.ReplaceValue,{"Value"}),
#"Grouped Rows" = Table.Group(#"Replaced Value", {"Name", "Place", "Attribute"}, {{"Data", each _, type table [Name=nullable text, Place=nullable text, Attribute=text, Value=text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each if List.NonNullCount ( [Data][Value] ) > 1 then Text.Combine ( List.Sort ( [Data] [Value] ), " - " ) else List.RemoveNulls ( [Data][Value] ){0} ),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
#"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Custom")
in
#"Pivoted Column"
Result
- JarekM3 years agoRegular Visitor
thank you for your help, it works perfectly😁