Forum Discussion
combine 2 nested tables within separate columns
I have a list "5 to rank" which I also converted to a table "TableFFromlisttest".
I would like to achieve the TableFFromlisttest [Table] to have an extra column which i can then perform a Group by List Max or similar to final show only the largest amount with corresponding Column1value.
The "levytable" [Table] is actually refering to the "Levy" table highlighted in yellow which is another query.
What m code can I use so firstly this sub step is achieved
I've tried to use Table.Combine
= Table.AddColumn(#"Removed Other Columns", "Custom", each Table.Combine(([TableFFromlisttest]),([levytable])))
but it doesn't work
Expression.Error: We cannot convert a value of type Table to type List.
Details:
Value=[Table]
Type=[Type]
Any assitance would be appreciated
- Anonymous4 years ago
I may have found a solution using:
= Table.AddColumn(Levies, "Custom.1", each Table.ExpandTableColumn(Table.NestedJoin([TableFFromlisttest], {"Column1"}, [levytable], {"Wording in Regs"}, "Testtable2", JoinKind.LeftOuter),"Testtable2", {"Levy $"}, {"Levy $"}))
result
6 Replies
- AnonymousNot applicable
I'm partially there using this code
= Table.AddColumn(#"Removed Other Columns", "Custom.1", each Table.SelectRows([levytable], each List.Contains(MyList,[WordinginRegs])))However the MyList was a test List. I would like the "list' component to point to each list within the 5 to rank column
- wdx223_DanielCommunity Champion
NewStep=Table.CombineColumns(PreviousStepName,{"TableFFromlisttest","leveytable"},each Table.AddColumn(_{0},"Levy $",each _{1}{[WordinginRegs=[Column1]]}?[#"Levy $"]?),"TableFFromlisttest")
- AnonymousNot applicable
I've worked out how to get the Max from the table
= Table.AddColumn(#"Added Custom12", "Custom", each Table.Max([Custom.1],"Levy $"))giving a record
which when expanded gives the result I'm after
Then only issue remaining is how to point to the List within the "5 to rank" column instead of my 'test list' called "MyList" which sits externally to the table i'm in
- AnonymousNot applicable
I've managed to get most of the solution myself using
#"Added Custom12" = Table.AddColumn(#"Removed Columns", "Custom.1", each Table.SelectRows([levytable], each List.Contains(MyList,[WordinginRegs]))), #"Added Custom6" = Table.AddColumn(#"Added Custom12", "Custom", each Table.Max([Custom.1],"Levy $")), #"Expanded Custom1" = Table.ExpandRecordColumn(#"Added Custom6", "Custom", {"WordinginRegs"}, {"WordinginRegs"}),except for refering to the 'static list 'MyList' instead of the List within the column [5 to rank]
Does anyone have any ideas?
- AnonymousNot applicable
I didn't have curly brackets.
= Table.AddColumn(Levies, "Custom", each Table.Combine({[TableFFromlisttest],[levytable]}))once added I get
I need somehow from this nested table to get the matching Levy $ for the words in Column1
- AnonymousNot applicable
I may have found a solution using:
= Table.AddColumn(Levies, "Custom.1", each Table.ExpandTableColumn(Table.NestedJoin([TableFFromlisttest], {"Column1"}, [levytable], {"Wording in Regs"}, "Testtable2", JoinKind.LeftOuter),"Testtable2", {"Levy $"}, {"Levy $"}))
result