Closing stock at month end with CLOSINGBALANCEMONTH
Show inventory on hand at the end of each month, quarter or year with CLOSINGBALANCEMONTH instead of a SUM that adds up months.
You will learn to
- Calculate a closing balance with CLOSINGBALANCEMONTH
- Predict which month end a quarter or year row uses
- Keep the sum across products while stopping the sum across dates
How it works
`CLOSINGBALANCEMONTH(expression, 'Date'[Date])` evaluates an expression on **one day only**: the last day of the month that holds the last visible date.
In a March row that is 31 March. In a Q1 row the last visible date is 31 March too, so the quarter shows March's closing stock. In a year row it is 31 December. Each row now shows one snapshot instead of adding several together.
Products still add up, because only the dates are narrowed: the Bikes row is the sum of the four bikes on that one day. That is exactly the semi-additive behavior you want. The expression can be a measure you already have, like `[Stock Units]`.
Practice it hands-on with a real data model and a live report that updates as you type.
Closing Customers = CLOSINGBALANCEMONTH([Customers], 'Date'[Date])