Daily DAX : Day 448 CLOSINGBALANCEWEEK
CLOSINGBALANCEWEEK DAX Function in Power BI
Description
The CLOSINGBALANCEWEEK function is a time intelligence function in DAX (Data Analysis Expressions) used in Power BI. It evaluates a given expression at the last date of the current week in the context, returning the "closing balance" for that week.
This function was introduced in 2025 as part of the new calendar-based time intelligence features, which provide better support for week-based calculations.
Syntax
CLOSINGBALANCEWEEK ( <Expression>, <Calendar> [, <Filter>] )
- <Expression>: The expression to evaluate (e.g., a measure like SUM of sales or inventory balance).
- <Calendar>: A reference to a calendar table or column (required in the new calendar-based functions).
- <Filter>: Optional filter expression (rarely used).
How It Works
In a report filtered to certain dates (e.g., a specific day or multiple days within a week), this function ignores the exact date filter and always computes the expression as of the end of the week containing the current context dates.
This is particularly useful for semi-additive measures where you don't sum values over time but take a snapshot at period end.
Use Cases
- Inventory or Stock Balance: Show the inventory level at the end of each week, regardless of the selected day.
- Account Balances: Display bank account or financial balances at week-end.
- Week-to-Date (WTD) Closing Values: Combine with other functions like TOTALWTD for week-based reporting in fiscal calendars that are week-aligned.
- Retail or Operations Reporting: When business weeks don't align with standard months (e.g., ISO weeks or custom fiscal weeks).
Example
Assuming a measure for current inventory:
Weekly Closing Inventory =
CLOSINGBALANCEWEEK (
SUM ( Inventory[StockLevel] ),
'Date'[Date] // or your Calendar table
)
In a table visual grouped by dates, this measure will show the same stock level for all days in a week — the value from the last day of that week.
Notes
- Requires a properly marked Date/Calendar table.
- Part of enhanced week-based time intelligence (e.g., pairs with OPENINGBALANCEWEEK, TOTALWTD).
- Enable the preview feature in Power BI if using early versions post-2025 introduction.
Comments
Post a Comment