Change in stock over a period: closing minus opening
Show how much inventory grew or shrank during a month, quarter or year, and return blank when there is no opening balance.
You will learn to
- Calculate a movement as closing minus opening
- Store balances in variables
- Return blank when the opening balance is missing instead of a misleading number
How it works
The **movement** of a balance is closing minus opening: positive when stock built up during the period, negative when it ran down. Because both balances follow the row, the same formula is a monthly movement in a month row and a yearly movement in a year row.
Watch the edges. When there is no opening balance (January 2024 has no day before it in the model), `closing - blank` treats the blank as zero, and the movement would claim the store gained all 917 units in one month. A report should show blank instead.
Variables keep this readable: store each balance once, test the opening one with `ISBLANK`, then return either `BLANK()` or the difference.
Practice it hands-on with a real data model and a live report that updates as you type.
Value Change =
VAR startValue = OPENINGBALANCEMONTH(SUM(Inventory[Stock Value]), 'Date'[Date])
VAR endValue = CLOSINGBALANCEMONTH(SUM(Inventory[Stock Value]), 'Date'[Date])
RETURN endValue - startValue