SOLVED

Calculation of children in list of parents/children

Iron Contributor

Hello,

 

I have a Bill Of Material (BOM) list, where the main item (parent) has several subitems, which in term may or may not have subitems again.

It looks like this:

ParentChildQty of child in parentChild has children
AA110
AA251
A2A2a20
A2A2b1

0

BB12

1

BB21

0

B1B1a1

0

and so on.

So the item "A" is made of 2 subcomponents, 1 x "A1" and 5 x "A2". 

In its turn, "A2" is composed of 2 x "A2a" and 1 x "A2b".

Or otherwise represented:

  • A
    • 1 x A1
    • 5 x A2
      • 2 x A2a
      • 1 x A2b

So A is finally composed of 1 x A1, 10 x A2a and 5 x A2b. It's this final level I'm interested in.

Same for B, etc.

 

I have also a second table, which is a list of quantities of the main items (parents that are not a child). 

ItemQty
A200
B500

 

What I need, is a calculation of the quantities of the "last level children" (so children that have no children themselves).

So in this case I would have:

SubcomponentQuantity
A1200
A2a10
A2b5
B11000

etc.

 

I am familiar with Power Queries (using mainly the UI) and formulas. No VBA please (if possible).

 

How would you go about this? (Taking into account that subcomponents may appear in different main items, so A2b can appear in C, F, G2, I3c, etc., each in different quantities).

 

Many thanks in advance!

2 Replies
best response confirmed by bartvana (Iron Contributor)
Solution

@bartvana See if the attached file helps you find a solution for your real BOM data. Not sure, though, about the arithmetic you applied in your last table. This is what I get.

Screenshot 2021-06-26 at 08.14.12.png

I have only used standard PQ UI commands. Nothing fancy.

Great, thanks!
I started experimenting myself in the mean time, and ended up using a similar merge as you. I didn't think about pivoting and unpivoting however, so that was interesting to see. Seems like a perfect solution to me.
1 best response

Accepted Solutions
best response confirmed by bartvana (Iron Contributor)
Solution

@bartvana See if the attached file helps you find a solution for your real BOM data. Not sure, though, about the arithmetic you applied in your last table. This is what I get.

Screenshot 2021-06-26 at 08.14.12.png

I have only used standard PQ UI commands. Nothing fancy.

View solution in original post