Forum Discussion
Stock opening closing calculation
- 1 year ago
Thankyou, Akash_Varuna, for your response.
Hi rajasekaro,We appreciate your question on the Microsoft Fabric Community Forum.
Please follow these steps to solve the issue:
- Load the data using Power BI’s "Enter Data" option or Excel.
- Create a Date Table using the CALENDAR function and connect it to the DOCDATE field.
- Use these measures:
a.Opening Qty: sums the quantity before the selected date using ALL().
b.Received Qty: includes only the entries with "p" values.
c.Issued Qty: includes only the entries with "m" values.
d.Closing Qty = Opening + Received – Issued.
This method will work smoothly with slicers and give correct, dynamic results for any date you select.
We have attached a screenshot and a sample pbix file for your reference:
If our answer helps you, please mark it as the accepted solution and give kudos. This will help other community members with similar questions.
If you have any more questions, please feel free to contact the Microsoft Fabric community.
Thank you.
Hi rajasekaro To calculate stock metrics please follow the below:
Opening Qty: Sum of all transactions before the selected date.
Received Qty: Sum of QTY where PLUSORMINUS = "p" for the selected date range.
Issued Qty: Sum of QTY where PLUSORMINUS = "m" for the selected date range.
Closing Qty: Calculated as [Opening Qty] + [Received Qty] - [Issued Qty].
- rajasekaro1 year ago
Helper III
its not showing correct value if i select date filter