Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi, I have been looking at a problem that I have and I need to convert one column to multiple columns based on their parent.
Here is the data that I have;
| LinkID | Product.Id | Product | Parent |
| 1 | 1 | Tree | |
| 1 | 2 | Apples | 1 |
| 1 | 3 | Big Leaves | 2 |
| 2 | 10 | Plane | |
| 2 | 12 | Fuel | |
| 2 | 14 | Wings | 10 |
| 2 | 16 | Flooring | 10 |
| 2 | 20 | Tail | 12 |
| 2 | 22 | Seats | 14 |
| 2 | 24 | Food | 14 |
| 2 | 24 | Staff | 20 |
And this is the result that I would like to get to;
| LinkID | Top | Middle | Bottom |
| 1 | Tree | Apples | Big Leaves |
| 2 | Plane;Fuel | Wings;Flooring;Tail | Seats;Food;Staff |
It is best if I have this in the Power Query.
Thanks in advance!!
Solved! Go to Solution.
hi @Anonymous
The formula is for calculated column, not custom column in edit queries.
Please download my sample pbix file and see the details in it.
Regards,
Lin
hi @Anonymous
For your case, you could try this way as below:
Step1:
Add a conditional column that which row is Top, Middle, Bottom by this formula like below:
Type = var _toptable=CALCULATETABLE(VALUES('Table'[Product.Id]),ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent]=BLANK()) return
var _Middletable=CALCULATETABLE(VALUES('Table'[Product.Id]),FILTER(ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent] in _toptable) ) return
var _Bottomtable=CALCULATETABLE(VALUES('Table'[Product.Id]),FILTER(ALLEXCEPT('Table','Table'[LinkID]),'Table'[Parent] in _Middletable) ) return
IF('Table'[Product.Id] in _toptable,"Top",IF('Table'[Product.Id] in _Middletable,"Middle",IF('Table'[Product.Id] in _Bottomtable,"Bottom")))
Then use this formula to create a New table
New table =
SUMMARIZE (
'Table',
'Table'[LinkID],
"Top", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ), FILTER ( 'Table', 'Table'[Type] = "Top" )),
"Middle", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ),FILTER ( 'Table', 'Table'[Type] = "Middle" )),
"Bottom", CALCULATE (CONCATENATEX ( VALUES ( 'Table'[Product] ), [Product], "," ),FILTER ( 'Table', 'Table'[Type] = "Bottom" ))
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
All looking good, I have started to follow your steps but when I am creating the custom column I get the below error;
Thank you for your help
hi @Anonymous
The formula is for calculated column, not custom column in edit queries.
Please download my sample pbix file and see the details in it.
Regards,
Lin
Great, yes I see now thank you very much and it all worked
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!