<!-- https://learnsql.cpetoday.com/functions/dax/openingbalancemonth -->
# OPENINGBALANCEMONTH

Language: DAX
Category: Time intelligence: balances
Syntax: OPENINGBALANCEMONTH(<expression>, <dates> [, <filter>])
Summary: Evaluates a balance at the start of the month in the filter context.
Returns: A value (a scalar).
Level: Intermediate
Related: CLOSINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR, CALCULATE, LASTNONBLANK

## What it does
OPENINGBALANCEMONTH returns a balance as it stood at the start of the month. For a balance such as stock or cash, the opening balance of March is the same as the closing balance of February. Finance teams use it for the inventory roll-forward (opening, purchases, sales, closing), the cash roll-forward and the start-of-period check in a close review.

## Syntax and arguments
- expression: the measure or column that holds the balance. Required.
- dates: the date column of the Calendar table. Required.
- filter: an optional filter, such as a warehouse or an account. Optional.

## Example
A warehouse manager reviews the inventory roll-forward for each month. The opening units are the stock on hand at the start of the month, from the daily snapshot table.

```dax
Opening Units = OPENINGBALANCEMONTH(SUM('Inventory'[Units]), 'Calendar'[Date])
```

In the March 2027 row, the measure returns the stock at the start of March. The roll-forward then reads opening units, plus receipts, minus issues, equals closing units.

## Example: a second, different use
The opening cash balance for a bank account for each month, to start the month's cash report.

```dax
Opening Cash =
OPENINGBALANCEMONTH(
    SUM('Bank_Balances'[Balance]),
    'Calendar'[Date],
    'Bank_Balances'[Account] = "Operating"
)
```

## Things to watch
- A good check is that the opening balance for a month equals the closing balance for the month before. Test that in a table before you rely on the roll-forward.
- Like the closing balance function, it needs a balance table with a row for the relevant date. A missing row gives a blank.
- Use the Calendar date column, and keep the Calendar complete.
- For a balance table where the snapshot is not daily, the last available balance before the period may be the right opening value. Check the data before you choose a pattern.

## In business terms
OPENINGBALANCEMONTH supports the inventory and cash roll-forwards in the month-end close, the opening balance check in a reconciliation, and the flow analysis that explains why a balance moved. Auditors ask for the roll-forward, so the opening figure needs to tie to the prior close.
