ENDOFYEAR

The ENDOFYEAR function returns the last day of the year in the current context (or the last year, if the current context includes more than one) for the specified date column.

Syntax

ENDOFYEAR(
    dates
    [, year_end_date]
)

Parameters
  • dates: Column containing dates.
  • year_end_date: Optional argument. Last day of the year (the default is December 31).
Returned value

The ENDOFYEAR function returns a table with a single column and a single row with a date.

Additional Information

The dates argument can be a reference to a column containing dates, an expression that returns a table with a single column containing dates, or a Boolean expression that defines a table with a single column containing dates.

The year_end_date argument is a text string containing a date in the local computer format and allows you to specify an end of the year other than December 31. Although this argument must include a year (for example, "10/21/2016"), only the day and month are considered.

Examples

The beginning and end of the month, the quarter and the year are shown in the following table for some dates of May 2011:

STARTOF and ENDOF functions

If we take the number of the month to the row headings in a matrix, the year to the column headings, and the following measure:

Last day of the year = ENDOFYEAR(DimDate[Datekey])

...to the Values field, we get the following result:

ENDOFYEAR function. Example of use
It can be seen how the measure created returns the last day of the year to which the month belongs.

If, in the same scenario, we modify the measure to specify a year-end date other than December 31, for example, May 5:

Last day of the year = ENDOFYEAR(DimDate[Datekey], "5/5/2014")

...the result is as follows:

ENDOFYEAR function. Example of use

Now, the last day of the year for either period is May 5.

Category
Time intelligence
Submitted by admin on Tue, 12/04/2018 - 11:45