Opening stock for a month with OPENINGBALANCEMONTH
Show the inventory a month started with, the closing balance of the day before, with OPENINGBALANCEMONTH.
You will learn to
- Calculate an opening balance with OPENINGBALANCEMONTH
- Explain why an opening balance equals the previous closing balance
- Explain why the first month in the data is blank
How it works
A month's **opening** stock is what was on the shelf when the month began, which is simply the closing stock of the day before. Stock counted on 31 January is February's opening stock.
`OPENINGBALANCEMONTH(expression, 'Date'[Date])` does that for you: it finds the first day of the month that holds the **first** visible date, steps back one day, and evaluates the expression there. In a quarter row it uses the first month of the quarter, so Q2's opening stock is the stock on 31 March.
The very first month in the model has no day before it: 31 December 2023 isn't in the date table, so January 2024 opens with a blank. That is honest, not a bug.
Practice it hands-on with a real data model and a live report that updates as you type.
Opening Stock Value = OPENINGBALANCEQUARTER(SUM(Inventory[Stock Value]), 'Date'[Date])