CALENDARAUTO 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 calculated automatically based on data in the model.

CALENDARAUTO([fiscal_year_end_month])  

Parameters

TermDefinition
fiscal_year_end_monthAny DAX expression that returns an integer from 1 to 12. If omitted, defaults to the value specified in the calendar table template for the current user, if present; otherwise, defaults to 12.

Returns a table with a single column named “Date” that contains a contiguous set of dates. The range of dates is calculated automatically based on data in the model.

The date range is calculated as follows:

  • The earliest date in the model which is not in a calculated column or calculated table is taken as the MinDate.

  • The latest date in the model which is not in a calculated column or calculated table is taken as the MaxDate.

  • The date range returned is dates between the beginning of the fiscal year associated with MinDate and the end of the fiscal year associated with MaxDate.

An error is returned if the model does not contain any datetime values which are not in calculated columns or calculated tables.

In this example, the MinDate and MaxDate in the data model are July 1, 2010 and June 30, 2011.

CALENDARAUTO() will return all dates between January 1, 2010 and December 31, 2011.

CALENDARAUTO(3) will return all dates between March 1, 2010 and February 28, 2012.

Community Additions

ADD
Show: