Eduard Paul Lakida
Eduard Paul Lakida

Reputation: 17

Concatenate child table rows in parent's new column in PowerBi / PowerQuery

i'm trying to achieve this report with powerquery:

parent - child related table transformation

enter image description here

I thought that it will be a very simple "Table.SelectRows('ChildTable', each [Id] = [ParentId])" followed by a concatenation... but i can't get it work. SelectRows function expects literal as comparator and i'm not able to find a workaroud.

Any help is appresiated.

Thanks.

Upvotes: 0

Views: 1341

Answers (1)

Marc Pincince
Marc Pincince

Reputation: 5202

Here's a way: Merge your two tables, set up like this...

enter image description here

and you'll see this...

enter image description here

Then add a new Custom Column, set up like this...

enter image description here

and you'll see this...

enter image description here

Then click the button to expand or extract the List values in the Custom column, and click on "Extract Values..."

enter image description here

and select to use a Comma as a delimiter...

enter image description here

and you'll see this...

enter image description here

Then you can rename the Custom column to ChildNames and delete the Id and ChildTable columns to end up with what you want...

enter image description here

Upvotes: 1

Related Questions