OpenBI Docs Buy

CLOSINGBALANCEMONTH

The expression's value on the final date of the month the filter context is in.

Group: Time intelligence. Compatible with DAX.

Syntax

CLOSINGBALANCEMONTH ( <expression>, <dates> [, <filter>] )
ParameterTypeDescription
expressionExpressionThe value wanted on that one date, usually a measure of a level such as a price, a stock or a balance.
datesDatesA column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model.
filterFilter
optional
A condition or a table that filters as well, as a filter argument of CALCULATE does.

Returns

Same type as the expression. The expression on the month's last date that the column holds.

Remarks

  • The month is the one of the last date in the filter context. Its last date is the last one the column has in that month: on a column of business days, the last business day.
  • It is the same as CALCULATE ( expression, ENDOFMONTH ( dates ) ), with the filter added when one is given.
  • Only that one date counts. When the expression is blank on it, the result is BLANK; it does not look back for an earlier date with a value (LASTNONBLANKVALUE does).
  • For an amount that adds up over time, such as liters sold, it gives the last day's part only: it is meant for levels such as prices, stocks and account balances.
  • Given a calendar instead of a column, it works on the calendar's own periods (fiscal years, retail months of four or five weeks, ISO weeks). A filter on a category the calendar does not define, such as a month on a calendar of weeks, can make the call an error.

Examples

The month's closing price, by month

The close of malting barley on the last business day of each month since July 2026.

EVALUATE
SUMMARIZECOLUMNS (
    Prices[Month],
    FILTER ( VALUES ( Prices[Month] ), Prices[Month] >= DATE ( 2026, 7, 1 ) ),
    FILTER ( VALUES ( Prices[Commodity] ), Prices[Commodity] = "Malting barley" ),
    "Closing", CLOSINGBALANCEMONTH ( [Close price], Prices[Date] )
)
ORDER BY Prices[Month]
Prices[Month]Closing
2026-07-014680.32
2026-08-014642.32
2026-09-015149.75
2026-10-015916.59

No looking back

The filter leaves out 30 September, the month's last date, so there is nothing to show.

EVALUATE
CALCULATETABLE (
    ROW (
        "Closing", CLOSINGBALANCEMONTH ( [Close price], Prices[Date] ),
        "Without the last day",
            CLOSINGBALANCEMONTH ( [Close price], Prices[Date], Prices[Date] <> DATE ( 2026, 9, 30 ) )
    ),
    Prices[Commodity] = "Malting barley",
    DATESBETWEEN ( Prices[Date], DATE ( 2026, 9, 1 ), DATE ( 2026, 9, 30 ) )
)
ClosingWithout the last day
5149.75(blank)

OPENINGBALANCEMONTH, CLOSINGBALANCEQUARTER, CLOSINGBALANCEYEAR, ENDOFMONTH, LASTNONBLANKVALUE.

Last updated · OpenBI Studio 0.3.74