Daily DAX : Day 453 ENDOFWEEK
Power BI DAX Function: ENDOFWEEK
Description
The ENDOFWEEK function is a Time Intelligence function in DAX (Data Analysis Expressions) used in Power BI. It returns the date that represents the end of the week containing a specified date (typically Saturday, as weeks are considered to start on Sunday by default in DAX time intelligence).
Syntax
ENDOFWEEK([, ])
: A column reference (usually from a Date table) or a date expression. Required. : Optional. Specifies the week-ending convention. Default is Saturday if omitted.
Examples
1. Basic usage (default: week ends on Saturday):
End of Week = ENDOFWEEK('Date'[Date])
For a date like January 8, 2026 (Thursday), this would return January 10, 2026 (Saturday).
2. In a measure for cumulative sales up to end of week:
Total Sales to End of Week = CALCULATE(
SUM(Sales[Amount]),
DATESBETWEEN('Date'[Date], STARTOFWEEK('Date'[Date]), ENDOFWEEK('Date'[Date]))
) Use Cases
- Grouping data by week: Create calculated columns in a Date table to mark the week-ending date for weekly aggregations.
- Time intelligence calculations: Used with functions like CALCULATE, TOTALYTD, or parallel period comparisons at a weekly level.
- Reporting on week-ending balances: Common in retail or finance where reports show metrics as of the week's end (e.g., inventory at week close).
- Custom calendars: Adjust with the optional parameter for non-standard weeks (e.g., weeks ending on Friday).
Note: For best results, use with a properly marked Date table. ENDOFWEEK relies on standard ISO-like week behavior unless customized.
Comments
Post a Comment