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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JVos
Helper IV
Helper IV

Performance issue at expanding or combining tablecolumn

I have a table with the following structure:

- ROUTING_ID_From

- ROUTING_ID_To

- DirectOrIndirect (= "Direct"  for all records)

- TableOfDescendents - this is a tablecolumn, containing the first three fields, DirectOrIndirect = "Indirect" for all records)

 

(The contents of TableOfDescendents is the result of a function that for each record processes the main table and calculates indirect relations. It's not a list, but a table.)

 

Now I want to combine the 'main table' with the contents of all the tablecolumns. Performance is OK until about 600 records in the main table (in that test case the average number of records in the 'sub tables' was 12).

 

How can this best be done? Here is the code I use:

 

TableOfDescendents = Table.AddColumn(MainTable, "TableOfDescendents", each fnTransitiveRelationTable(MainTable, [ROUTING_ID_From])),
CombinedDescendents = Table.Combine(TableOfDescendents[TableOfDescendents]), TableOfAllDescentantsTables = Table.Combine({MainTable, CombinedDescendents}),
1 ACCEPTED SOLUTION
Nolock
Resident Rockstar
Resident Rockstar

Hi @JVos,

you're right, sorry, my bad 😞

Please read my new blog post, it should help with the performance: https://community.powerbi.com/t5/Community-Blog/Transitive-Closure-in-Power-Query/ba-p/782678

View solution in original post

3 REPLIES 3
Nolock
Resident Rockstar
Resident Rockstar

Hi @JVos,

the code should look like the example below if you still use the solution from https://community.powerbi.com/t5/Power-Query/Recursive-query-to-derive-indirect-relationships/td-p/7...

 

TableOfDescendents = Table.AddColumn(MainTable, "TableOfDescendents", each fnTransitiveRelationTable(MainTable, [ROUTING_ID_From])),
TableOfAllDescentantsTables = Table.Combine({MainTable, TableOfDescendents}),

If it is still slow, try the following:

TableOfDescendents = Table.Buffer(Table.AddColumn(MainTable, "TableOfDescendents", each fnTransitiveRelationTable(MainTable, [ROUTING_ID_From]))),
TableOfAllDescentantsTables = Table.Combine({MainTable, TableOfDescendents}),

Hi @Nolock,

 

Your proposal omits the indirect relations in the final result. Note that the initial code - in the solution you refer to - was:

TableOfDescendents = Table.AddColumn(ChangedType, "TableOfDescendents", each fnTransitiveRelationTable(ChangedType, [From])),
TableOfAllDescentantsTables = Table.Combine({ChangedType, Table.Combine(TableOfDescendents[TableOfDescendents])}),

To see what happens step-by-step, I broke the last line into two lines of code:

TableOfDescendents = Table.AddColumn(ChangedType, "TableOfDescendents", each fnTransitiveRelationTable(ChangedType, [ROUTING_ID_From])),
CombinedDescendents = Table.Combine(TableOfDescendents[TableOfDescendents]),
TableOfAllDescentantsTables = Table.Combine({ChangedType, CombinedDescendents}),

Now you propose in fact to remove to combine TableOfDescendents[TableOfDescendents], which makes that the indirect relations are not in the end result.

Nolock
Resident Rockstar
Resident Rockstar

Hi @JVos,

you're right, sorry, my bad 😞

Please read my new blog post, it should help with the performance: https://community.powerbi.com/t5/Community-Blog/Transitive-Closure-in-Power-Query/ba-p/782678

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors