Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

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. 

Final result.png

The "levytable" [Table] is actually refering to the "Levy" table highlighted in yellow which is another query.

levytable column.jpg

What m code can I use so firstly this sub step is achieved1st sub step.jpg

 

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

1 ACCEPTED SOLUTION
Anonymous
Not 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 $"}))

Leroy_1-1660008653161.png

result

Result.jpg

View solution in original post

6 REPLIES 6
Anonymous
Not 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 $"}))

Leroy_1-1660008653161.png

result

Result.jpg

Anonymous
Not applicable

I didn't have curly brackets. 

= Table.AddColumn(Levies, "Custom", each Table.Combine({[TableFFromlisttest],[levytable]}))

once added I get

Leroy_2-1659932807433.png

I need somehow from this nested table to get the matching Levy $ for the words in Column1

Anonymous
Not 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]ListContainsMyList.jpg

 

Does anyone have any ideas?

Anonymous
Not 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

Max gives record.jpg

which when expanded gives the result I'm after

Expanded.jpg

 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

 

 

wdx223_Daniel
Super User
Super User

NewStep=Table.CombineColumns(PreviousStepName,{"TableFFromlisttest","leveytable"},each Table.AddColumn(_{0},"Levy $",each _{1}{[WordinginRegs=[Column1]]}?[#"Levy $"]?),"TableFFromlisttest")

Anonymous
Not 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

5 to rank list.jpg

ListContainsMyList.jpg

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.