Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculate inventory daily

Hi, anyone could help me with calculate inventory at the end of the day, and then use it for initial inventory the next day

 

This is a monthly report , i have initial inventory as a fixed number, i have all productions and consumptiosn defined. IT's easy in  excel to achieve this, but i'd like to try some What if analysis so i need to model this in PowerBi

All data in green is a information i got as a input, without change during month.  

It's some kind of budget, then i would have to create the actual values and compare them. But i'm having troubles with this,

thank you in advance,

I tried measures and prev day, but doesnt' seem to work the way i want.

 

 

  • Hi, Anonymous ;

    You could try it.

    Final Inventory =
    27389
        + CALCULATE (
            SUM ( [Production] ) - SUM ( 'Table'[Consumption 1] )
                - SUM ( 'Table'[Consumption 2] )
                - SUM ( 'Table'[Consumption3] ),
            FILTER ( ALL ( 'Table' ), [Date] <= MAX ( 'Table'[Date] ) )
        )
    
    Initial Inventory = CALCULATE([Final Inventory],FILTER(ALL('Table'),[Date]<MAX('Table'[Date])))

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please indicate if this needs to be done in DAX or if it can be done in Power Query.

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous ;

    You could try it.

    Final Inventory =
    27389
        + CALCULATE (
            SUM ( [Production] ) - SUM ( 'Table'[Consumption 1] )
                - SUM ( 'Table'[Consumption 2] )
                - SUM ( 'Table'[Consumption3] ),
            FILTER ( ALL ( 'Table' ), [Date] <= MAX ( 'Table'[Date] ) )
        )
    
    Initial Inventory = CALCULATE([Final Inventory],FILTER(ALL('Table'),[Date]<MAX('Table'[Date])))

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much I really appreciate your time to answer. Best Regards