Daily DAX : Day 436 ENDOFMONTH
Power BI DAX Function: ENDOFMONTH
Description
The ENDOFMONTH function is a time intelligence function in DAX (Data Analysis Expressions) used in Power BI. It returns a table containing a single column and single row with the last date of the month in the current filter context, based on the provided dates.
Syntax
ENDOFMONTH()
Parameters:
: A column reference containing dates, or a table expression returning a single column of dates.
Return Value: A single-column table with one row containing the end-of-month date.
Example
Assuming you have a Date table marked as a date table:
Month End Sales = CALCULATE(
SUM(Sales[Amount]),
ENDOFMONTH('Date'[Date])
)
This measure calculates the total sales as of the last day of the month in the current context (e.g., for monthly reports, it aggregates sales up to month-end).
Use Cases
- Month-end reporting: Calculate metrics like closing balances, inventory levels, or total sales at the end of each month.
- Time intelligence calculations: Often used inside CALCULATE to modify filters for period-end snapshots (e.g., account balances that are only meaningful at month-end).
- Comparing period-end values: Useful for year-over-year or month-over-month comparisons of end-of-period figures.
- Semi-additive measures: Ideal for measures that should not be summed across days, but evaluated only at period ends.
Note: ENDOFMONTH is preferred over EOMONTH(..., 0) in time intelligence scenarios because it returns a table filter suitable for CALCULATE. It requires a proper date table for accurate results across contexts.
Comments
Post a Comment