ENDOFWEEK DAX Function (Time Intelligence)  Context Transition

Returns the end of week.

Syntax

ENDOFWEEK ( <Calendar> )
Parameter Attributes Description
Calendar

The name of a calendar.

Return values

Table An entire table or a table with one or more columns.

A table with a single row that contains the primary column of each calendar category and the time-related columns of the calendar.

Notes

In order to use any time intelligence calculation, you need a well-formed date table. The Date table must satisfy the following requirements:

  • All dates need to be present for the years required. The Date table must always start on January 1 and end on December 31, including all the days in this range. If the report only references fiscal years, then the date table must include all the dates from the first to the last day of a fiscal year. For example, if the fiscal year 2008 starts on July 1, 2007, then the Date table must include all the days from July 1, 2007 to June 30, 2008.
  • There needs to be a column with a DateTime or Date data type containing unique values. This column is usually called Date. Even though the Date column is often used to define relationships with other tables, this is not required. Still, the Date column must contain unique values and should be referenced by the Mark as Date Table feature. In case the column also contains a time part, no time should be used – for example, the time should always be 12:00 am.
  • The Date table must be marked as a date table in the model, in case the relationship between the Date table and any other table is not based on the Date.
The result of time intelligence functions has the same data lineage as the date column or table provided as an argument.

Remarks

ENDOFWEEK requires a calendar reference. You define a calendar in the model for calendar-based time intelligence. The calendar must tag the Week category. With a date column, or with a calendar that does not tag the Week category, ENDOFWEEK returns an error.

The result is a table with a single row. The row has the primary column of each calendar category and the time-related columns of the calendar.

The calendar defines the weeks. ENDOFWEEK finds the last date visible in the filter context and returns the last day of the week that includes this date. For example, if the weeks end on Saturday and the last visible date is a Wednesday, the result is the next Saturday. The result can be a date that the filter context hides, and it can be in the next month. For example, with a filter on August 2008, the last visible date is August 31, 2008, which is a Sunday. ENDOFWEEK ( ‘Weekly 445’ ) returns September 6, 2008.

A context transition applies. For example, in ADDCOLUMNS over a list of dates, ENDOFWEEK uses the date of the current row.

With a calendar, CALCULATE removes only the filters on the columns of the calendar. The filters on the other columns of the date table stay, for example a filter on the day of the week. With the date column of a table marked as a date table, CALCULATE removes all the filters on the date table.

Do not use ENDOFWEEK in visual calculations. The result is likely to have no meaning.

This function is not supported in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

» 3 related functions

Examples

--  ENDOFWEEK requires a calendar that tags the Week category.
--  Weekly 445 is a calendar defined on the Date table.
--  Its weeks start on Sunday and end on Saturday.
--  If the selection is a single date, the result is the end of its week.
--  The result has the primary column of each calendar category
--  and the time-related columns of the calendar.
EVALUATE
CALCULATETABLE (
    ENDOFWEEK ( 'Weekly 445' ),
    'Date'[Date] = DATE ( 2008, 8, 13 )
)

--  If the selection contains more than one week,
--  the result is the end of the last week.
EVALUATE
CALCULATETABLE (
    ENDOFWEEK ( 'Weekly 445' ),
    'Date'[Date] >= DATE ( 2008, 8, 6 ) &&
    'Date'[Date] <= DATE ( 2008, 8, 13 )
)
Date 445 Week Number 445 Year Week Number 445 Period Number 445 Year Period Number 445 Quarter Number 445 Year Quarter Number 445 Year Number
2008-08-16 33 200833 8 200808 3 20083 2008
Date 445 Week Number 445 Year Week Number 445 Period Number 445 Year Period Number 445 Quarter Number 445 Year Quarter Number 445 Year Number
2008-08-16 33 200833 8 200808 3 20083 2008
--  Sales on Week End returns the sales of the last day of the week
--  that contains the last date visible in the filter context.
--  Week W33-2008 of Weekly 445 goes from Sunday, August 10
--  to Saturday, August 16, 2008.
DEFINE
    MEASURE Sales[Sales on Week End] =
        CALCULATE ( [Sales Amount], ENDOFWEEK ( 'Weekly 445' ) )
EVALUATE
SUMMARIZECOLUMNS (
    'Date'[Date],
    TREATAS ( { "W33-2008" }, 'Date'[445 Year Week] ),
    "Sales Amount", [Sales Amount],
    "Sales on Week End", [Sales on Week End]
)
ORDER BY 'Date'[Date]
Date Sales Amount Sales on Week End
2008-08-10 25856.037000000015 14246.82
2008-08-11 10413.719999999992 14246.82
2008-08-12 66199.9589999999 14246.82
2008-08-13 1524.483 14246.82
2008-08-14 18266.229000000003 14246.82
2008-08-15 25700.373000000003 14246.82
2008-08-16 14246.820000000007 14246.82

Related functions

Other related functions are:

Last update: Nov 16, 2026   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/en-us/dax/endofweek-function-dax

2018-2026 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Passed by Expression

This parameter is passed by expression and can be evaluated multiple times in different evaluation contexts.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of ENDOFWEEK? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.