CALENDAR

Updated on

CALENDAR is a DAX function that returns a table with one column of all dates between a start date and an end date.

Syntax

CALENDAR(
   StartDate,
   EndDate
)
Argument Properties Description
StartDate The start date in datetime format.
EndDate The end date in datetime format.

Return Values

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.

Remarks

  • An error is returned if start_date is greater than end_date.

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

Examples

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

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

For a data model which includes actual sales data and future sales forecasts, the following expression returns a date table covering the range of dates in both the Sales and Forecast tables.

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

Other functions related to CALENDAR are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/calendar-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy