Forum Discussion
Inventory and Stock balance calculation
- Anonymous7 months ago
Hi DineshJadhav ,
Thank you for following up.
I’ve attached the PBIX file, which contains the full working setup, including the sample data model, relationships, base measures, and the final running stock balance calculation.This approach anchors the calculation to the opening inventory of the first visible month and then accumulates the net movement (Supply minus Demand) up to the current month. By adding this cumulative movement to the opening inventory, the balance rolls forward correctly each month without referencing the previous month’s result directly.
Please find the attached .pbix file below.
- 7 months ago
Hi DineshJadhav please try this
Stock Balance by SKU =VAR CurrentMonth =MAX ( 'Date Table'[Month Index] )
VAR FirstMonth =CALCULATE (MIN ( 'Date Table'[Month Index] ),ALLSELECTED ( 'Date Table'[Month Index] ))
RETURNSUMX (VALUES ( SKU[SKU Code] ),
VAR OpeningInventory =CALCULATE (SUM ( Inv[Inventory On Hand] ),'Date Table'[Month Index] = FirstMonth)
VAR MovementToDate =CALCULATE ([Net Movement],FILTER (ALL ( 'Date Table'[Month Index] ),'Date Table'[Month Index] >= FirstMonth&& 'Date Table'[Month Index] <= CurrentMonth))
RETURNOpeningInventory + MovementToDate)
Hi DineshJadhav ,
Thank you for following up.
I’ve attached the PBIX file, which contains the full working setup, including the sample data model, relationships, base measures, and the final running stock balance calculation.
This approach anchors the calculation to the opening inventory of the first visible month and then accumulates the net movement (Supply minus Demand) up to the current month. By adding this cumulative movement to the opening inventory, the balance rolls forward correctly each month without referencing the previous month’s result directly.
Please find the attached .pbix file below.
HI DineshJadhav ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions
- Anonymous7 months agoNot applicable
Hi DineshJadhav ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
- DineshJadhav6 months agoFrequent Visitor
Hi Anonymous,
This is working for Me. Sorry I forget to reply on this.Thank you. Really Appreciate your help.
- Anonymous6 months agoNot applicable
Hi DineshJadhav ,
Glad to hear it’s working for you. Thanks for the update.
Feel free to reach out if you need any further help.Best regards,
v-sshirivolu