Forum Discussion
Anonymous
3 years agoNot applicable
BOM explosion inside BOM
Hello, please I need some help on the following situation: I have 3 tables: SalesOrderTable OrderNum Product Quantity ON-01 P1 10 ON-01 P2 20 ON-01 P3 30 ON-02 P1 20...
- Anonymous3 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create measure.
Finished Products quantities = var _select=SELECTEDVALUE('SalesOrderTable'[Product]) var _sumquantity=SUMX(FILTER(ALL(SalesOrderTable),'SalesOrderTable'[Product]=_select),[Quantity]) var _p1=MAXX(FILTER(ALL('Product Category'),'Product Category'[Product]=_select),[Category]) var _column=SELECTCOLUMNS(FILTER(ALL('Product Category'),'Product Category'[Category]=_p1),"1",[Product]) return IF( MAX('BillsOfMaterialTable'[FinishedProduct]) in _column&&MAX('BillsOfMaterialTable'[FinishedProduct])=_select,_sumquantity *MAX('BillsOfMaterialTable'[Percentage%]),0)Raw Materials = var _select=SELECTEDVALUE('SalesOrderTable'[Product]) var _sumquantity=SUMX(FILTER(ALL(SalesOrderTable),'SalesOrderTable'[Product]=_select),[Quantity]) var _p1=MAXX(FILTER(ALL('Product Category'),'Product Category'[Product]=_select),[Category]) var _column=SELECTCOLUMNS(FILTER(ALL('Product Category'),'Product Category'[Category]=_p1),"1",[Product]) return IF( NOT(MAX('BillsOfMaterialTable'[RawMaterial]))in _column&&MAX('BillsOfMaterialTable'[FinishedProduct])=_select,_sumquantity *MAX('BillsOfMaterialTable'[Percentage%]),0)2. Result:
If the results do not meet your expectations, can you show the expected results in the form of pictures, how to obtain Finished Products quantities and Raw Materials, we can better help you
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
EdBrasier
2 years agoNew Member
If you want to use a recursive Power Query M fonction, I have a BOM fonction here with unlimited explosions.
https://github.com/edouardbrasier/Recursion-example-bill-of-materials