Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

BOM Explosion using Hierarchy & HierarchyBelongsTo

I'm attempting to perform a bill of materials explosion in QV using Hierarchy & HierarchyBelongsTo. My data looks something like this:

ParentChildTypeQty
ABMake2
AEBuy1
AFBuy1
BCMake2
CDBuy2
DGMake1
GHBuy1


My goal it to get a flat table depicting the total BOM structure for several hundred thousand parts (perhaps millions of parts). The resulting table would look something like this:

ParentChildTypeQtyLevel
AAMake10
ABMake21
ACMake42
ADBuy83
AEBuy11
AFBuy11
BBMake10
BCMake21
BDBuy42
DDMake10
DGMake11
DHBuy12
GGMake10
GHBuy11


Hierarchy seems to get me close, but, I'm missing top level parent ID and am not sure how to calculate the expanded quantities. Any ideas?

12 Replies
Not applicable
Author

Any one have any ideas???

suniljain
Master
Master

Pls Try Attached File

Not applicable
Author

HI

anyone solved this problem....

could anyone tell me how to solve this issue....

Not applicable
Author

Same problem, still no solution 🙂

Did anyone solve this yet? I'm trying to combine a Hierarchy with another HierarchyBelongsTo on the same source. The solution seems so close and yet so far away...

hic
Former Employee
Former Employee

Two points:

1) You need to have this in two tables, since you can have several transactions on the same node.

2) You need to define a root node – i.e. a node with NULL as parent. I have added this to the source table, but this can be done in the script instead.

Not applicable
Author

Thx for replying.

To meet my reporting requirements i need a BOM bridge table like this:

child, ancestor, Qty

A, A, 1

A, B, 2

A, C, 4

A, D, 8

B, B, 1

B, C, 2

B, D, 4

C, C, 1

C, D, 2

D, D, 1

Then in the report, child will relate to an article table and ancestor will relate to an invoice line table. So when i select A, i want to calculate the total sales qty amount even for invoice lines that where booked on B, C or D.

I don't think that the example you made solves this problem.

hic
Former Employee
Former Employee

I am fairly sure that the pivot table calculates exactly what you want. On the group for ‘A’, Qty’s for all its sub-nodes will be summed.

If you instead use HierarchyBelongsTo, you will get a bridge table which will give you an Ancestor list box, which could be useful, but it is not necessary for the summation. See new attachment.

Further, if you put both the Ancestor and the Qty in the same table, you will double-count the sold units: the same unit will appear on several lines.

hic
Former Employee
Former Employee

... but if you really want the bridge table with quantities in it, then just take the HierarchyBelongsTo table in my example and join it with the original transaction table. (Don't load Parent in the transaction table).

Not applicable
Author

Also did this myself, but how do i calculate how many times G is in A (from your example it should be 8)...

In your example, if i make a table graph with NodeID and AncestorID in it as dimensions and sum(Qty) as expression, the numbers don't give what i need.