Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
clubspec
Helper III
Helper III

Calculated Column to aggregate results from various tables

Hi Gurus,

Measure.JPG

 

 

 

 

I have three tables (Inventory, BOM, Work Orders) and I am trying to build a "Forecast Qty on Hand" column inside the Inventory table.
For example, based on Work Orders Table I have an order to make 10 of Table Lamp; and according to BOM table it requires 10 times Raw Material Qty listed on the BOM, and therefore my Calculated Column in Inventory Table will have Qty on Hand of Raw Material minus the Qty consumed in the Work Orders.

Is this easy to achieve?  The challenge is BOM table has multiple Required Material for a Finished Goods.

 

Appreciate your help in advance, I hope I can explain myself better.

Thanks,

Ray

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @clubspec ,

 

To what I can understand you want to calculate the total inventory after the work orders correct? 

So for the finish goods you will have an increase of 10 each and for the raw materials a decrease.

 

Make the following setup:

  • Relationships:
    • Inventory[Item n] 1 -> BOM[Required Material] *
    • Inventory[Item n] 1 -> Work Order [Item Nº] * (INACTIVE RELATIONSHIP)
    • Work Order [Item Nº] * ->BOM[Required Material] *
  • Then add the following measure:
Forecast = 
SUM ( Inventory[Qty on Hand] )
    + CALCULATE (
        SUM ( 'Work Order'[Order Qty] );
        USERELATIONSHIP ( Inventory[Item Nº]; 'Work Order'[Item Nº] )
    )
    - SUMX (
        ADDCOLUMNS (
            BOM;
            "@orderQty"; SUMX (
                FILTER ( 'Work Order'; 'Work Order'[Item Nº] = BOM[Finish Good] );
                'Work Order'[Order Qty]
            ) * BOM[Require Qty]
        );
        [@orderQty]
    )

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @clubspec ,

 

To what I can understand you want to calculate the total inventory after the work orders correct? 

So for the finish goods you will have an increase of 10 each and for the raw materials a decrease.

 

Make the following setup:

  • Relationships:
    • Inventory[Item n] 1 -> BOM[Required Material] *
    • Inventory[Item n] 1 -> Work Order [Item Nº] * (INACTIVE RELATIONSHIP)
    • Work Order [Item Nº] * ->BOM[Required Material] *
  • Then add the following measure:
Forecast = 
SUM ( Inventory[Qty on Hand] )
    + CALCULATE (
        SUM ( 'Work Order'[Order Qty] );
        USERELATIONSHIP ( Inventory[Item Nº]; 'Work Order'[Item Nº] )
    )
    - SUMX (
        ADDCOLUMNS (
            BOM;
            "@orderQty"; SUMX (
                FILTER ( 'Work Order'; 'Work Order'[Item Nº] = BOM[Finish Good] );
                'Work Order'[Order Qty]
            ) * BOM[Require Qty]
        );
        [@orderQty]
    )

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you so much @MFelix 

I appreciate your instructions and the model!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors