CALENDAR Function (DAX)

 
System_CAPS_ICON_note.jpg Note


This function is included in SQL Server 2016 Analysis Services (SSAS), Power Pivot in Excel 2016, and Power BI Desktop only. Information provided here is subject to change.

Returns a table with a single column named “Date” that contains a contiguous set of dates. The range of dates is from the specified start date to the specified end date, inclusive of those two dates.

CALENDAR(<start_date>, <end_date>)  

Parameters

TermDefinition
start_dateAny DAX expression that returns a datetime value.
end_dateAny DAX expression that returns a datetime value.

Returns a table with a single column named “Date” containing a contiguous set of dates. The range of dates is from the specified start date to the specified end date, inclusive of those two dates.

An error is returned if start_date is greater than end_date.

The following formula returns a table with dates between January 1st, 2005 and December 31st, 2015.

=CALENDAR (DATE (2005, 1, 1), DATE (2015, 12, 31))

For a data model which includes actual sales data and future sales forecasts. The following expression returns the date table covering the range of dates in these two tables.

=CALENDAR (MINX (Sales, [Date]), MAXX (Forecast, [Date]))

Community Additions

ADD
Show: