Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello Community,
I’m currently working on a dashboard in Power BI to manage and visualize the distribution of a daily production plan in a repetitive manufacturing setup. I’m facing challenges with handling a multi-level Bill of Materials (BOM) structure, particularly in distributing the production quantities from parent items down to their respective children and sub-children.
For example, I have:
I only have the production plan at the parent level, and I need to explode the BOM to calculate and distribute the required quantities to each child and sub-child based on their usage in the hierarchy.
Has anyone implemented a similar solution in Power BI? I’d appreciate any guidance, DAX patterns, or data modeling tips to achieve this.
Thanks in advance
Solved! Go to Solution.
I based the solution on the sample data. It is difficult to come up with a solution when the sample data is not a complete representation of the actual.
Hi @ARYAL_Gunjan369,
kindly requesting you to share sample data in a workable format such as a text file, Excel file, or PBIX file.
Additionally, please include clear and detailed requirements on additional requirements, along with the expected output, so we can better understand the scenario and assist you more effectively.
Regards,
Prasanna Kumar
Hi @ARYAL_Gunjan369,
we kindly request you to share sample data in a workable format such as a text file, Excel file, or PBIX file.
Additionally, please include clear and detailed requirements on additional requirements, along with the expected output, so we can better understand the scenario and assist you more effectively.
Hi @ARYAL_Gunjan369,
If the issue still persists, we kindly request you to share sample data in a workable format such as a text file, Excel file, or PBIX file rather than screenshots.
Additionally, please include clear and detailed requirements, along with the expected output, so we can better understand the scenario and assist you more effectively.
Thanks & Regards,
Prasanna Kumar
Sorry to say that this solution didnot worked for me in my case. As it is not related only to one hierarchy as i told in my query that the partents and child must match the profit center and mrp controller. Thanks.
I based the solution on the sample data. It is difficult to come up with a solution when the sample data is not a complete representation of the actual.
Hi @ARYAL_Gunjan369,
Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to @danextian for prompt and helpful responses.
Just following up to see if the solution provided by community member were helpful in addressing the issue.
If one of the responses helped resolve your query, please consider marking it as the Accepted Solution. Feel free to reach out if you need any further clarification or assistance.
Best regards,
Prasanna Kumar
Thanks for the response. Due to data security policies, I can’t share the actual PBIX or Excel files, but here’s a simplified and relatable example:
BOM Table (Parent-Child Relationships):
Parent A | Child 1 | 2 |
Parent A | Child 2 | 3 |
Child 1 | Enfant 1 | 1 |
Child 1 | Enfant 2 | 2 |
Child 2 | Enfant 3 | 1 |
Parent B | Child 3 | 1 |
Parent B | Child 4 | 2 |
Child 4 | Enfant 4 | 3 |
Child 4 | Enfant 5 | 1 |
Production Plan Table:
Parent A | 5000 |
Parent B | 3000 |
I want to calculate the required quantities for each child and sub-child based on the parent production plan and the BOM structure. For example:
Parent A = 5000 PCS
Parent B = 3000 PCS
To facililate the calculation, transform the Parent-Child table into a format where there is a separate column for the Parent, Child and Infant.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgsSs0rUXBU0lFyzsjMSVEwBLKMlGJ1sEgZAVnGYCmEUte8tESgIhDTELuUEdxAhClQKWO4LqhdTnC78EiZoBlogjDQBM2FSFKmEANjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Parent Item" = _t, #"Child Item" = _t, #"Quantity per Parent" = _t]),
// Get list of parent and child columns
ParentList = List.Distinct(Source[Parent Item]),
ChildList = List.Distinct(Source[Child Item]),
// Leaf nodes = children that never appear as parents
LeafNodes = List.Difference(ChildList, ParentList),
// Filter only leaf node rows
LeafsOnly = Table.SelectRows(Source, each List.Contains(LeafNodes, [Child Item])),
// Define recursive function to trace lineage upward
RecurseFn =
let
f = (child as text) as list =>
let
parentRow = Table.SelectRows(Source, each [Child Item] = child),
parent = if Table.IsEmpty(parentRow) then null else parentRow{0}[Parent Item]
in
if parent = null then {child}
else List.Combine({@f(parent), {child}})
in f,
// Add full lineage path for each leaf
WithPath = Table.AddColumn(LeafsOnly, "Path", each RecurseFn([Child Item])),
// Split the path into Parent, Child, Enfant
WithHierarchy = Table.AddColumn(WithPath, "Hierarchy", each [
Parent = try [Path]{0} otherwise null,
Child = try [Path]{1} otherwise null,
Enfant = ( try [Path]{2} otherwise null ) ?? Child
]),
#"Expanded Hierarchy" = Table.ExpandRecordColumn(WithHierarchy, "Hierarchy", {"Parent", "Child", "Enfant"}, {"Parent", "Child", "Enfant"}),
#"Removed Other Columns" = Table.SelectColumns(#"Expanded Hierarchy",{"Parent", "Child", "Enfant", "Quantity per Parent"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Quantity per Parent", "Enfant Qty"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Child Qty", each let
child = [Child],
row = List.PositionOf(Source[Child Item], child)
in
Source[Quantity per Parent]{row}),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Parent", "Child", "Child Qty", "Enfant", "Enfant Qty"}),
#"Changed Type" = Table.TransformColumnTypes(#"Reordered Columns",{{"Parent", type text}, {"Child", type text}, {"Child Qty", Int64.Type}, {"Enfant", type text}, {"Enfant Qty", Int64.Type}})
in
#"Changed Type"
Note: custom function above was created with the help of AI with minor editing.
Once loaded, create a one to many single direction relationship from the planned quantity table to parent child hierarchy.
Create this calculated column
Planned Qty =
VAR _PlannedQtyByParent =
RELATED ( PlannedQuantity[Planned Quantity] )
RETURN
ParentChildHierarchy[Child Qty] * ParentChildHierarchy[Enfant Qty] * _PlannedQtyByParent
Please see the attached pbix.
Please start by providing a workable sample data (not an image), your expected result from the same sample data and your reasoning behind -
how do you intend to explode/breakdown the parent total into into its sub-children?
weighted percentage? Equally?
You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.