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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
plaralema
Advocate III
Advocate III

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.

 

 

Inventory_DAX.jpg

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @plaralema ;

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:

vyalanwumsft_0-1638851093087.png

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.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @plaralema ;

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:

vyalanwumsft_0-1638851093087.png

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.

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

lbendlin
Super User
Super User

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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