Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Beginning and Ending Inventory Balance

Hello all,   I am trying to recreate the table below in PBI. I have models with measures for current inventory, forecasts, orders shipped, production, and transfers. I need to create a table that w...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from lbendlin.

     

    Hi Anonymous ,

    Based on the data you said you provided, I unpivoted  your tables and created the relationship shown below:

     

    After understanding your logic, I adjusted the rows and columns and hopefully this will meet your needs as well,here are the measures l created:

     

    1.Perform the calculations in the figure:

     

    sumsales = SUM('Current Inv'[Inventory])+SUM('Current Month Shipments'[ Month Shipments])-SUM('Forecast'[Forecast])+SUM('Monthly Production Transfer Rec'[Receipts])

     

     

    2.Calculate total sales up to the current selection month:

     

    End of month balance =
    IF(NOT(SUM('Current Inv'[Inventory])=BLANK()&&SUM('Current Month Shipments'[ Month Shipments])=BLANK()&&SUM('Forecast'[Forecast])=BLANK()&&SUM('Monthly Production Transfer Rec'[Receipts])=BLANK()),
    SUMX(FILTER(ALL('Month'),'Month'[YearMonth]<=SELECTEDVALUE('Month'[YearMonth])),[sumsales]))

     

     

    3.Get the unrestricted inventory similar to the requirement figure:

     

    Inventory =
    IF(NOT(ISBLANK(SUM('Current Inv'[Inventory]))),SUM('Current Inv'[Inventory]),
    IF(NOT(SUM('Current Inv'[Inventory])=BLANK()&&SUM('Current Month Shipments'[ Month Shipments])=BLANK()&&SUM('Forecast'[Forecast])=BLANK()&&SUM('Monthly Production Transfer Rec'[Receipts])=BLANK()),
    SUMX(FILTER(ALL('Month'),'Month'[Index] <= SELECTEDVALUE('Month'[Index]) -1),[sumsales])))

     

     

    The final result is as follows:

    Best Regards,
    Zhu
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.