OpenBI Docs Buy

CALENDARAUTO

A table of one column, [Date], of whole years around the dates in the model's imported date columns; kept for models that use it, where a date table of the model's own is the better choice.

Group: Date and time. Compatible with DAX.

Syntax

CALENDARAUTO ( [<fiscal_year_end_month>] )
ParameterTypeDescription
fiscal_year_end_monthWhole number
optional
The last month of the financial year, 1 to 12. Left out, the year ends in December.

Returns

Table. One column, [Date], with every day of the whole years that hold the model's dates.

Remarks

  • It looks at the date columns of the model's tables, finds the earliest and the latest date, and returns every day from the start of the earliest date's year to the end of the latest date's year.
  • With a fiscal year, the years run from the month after the one given: with 6, from 1 July to 30 June.
  • Every date in those columns counts: a birth date, a far-off maturity or a placeholder such as 31 December 9999 stretches the table to that year.
  • A model with no dates in any column is an error, and so is a month outside 1 to 12.
  • The table changes whenever the data does. A date table built with CALENDAR over a range you choose stays under your control.

Examples

The range it finds in the Example Brewery

The earliest date is the first sales month, November 2023; the latest a bond's maturity in March 2033.

EVALUATE
ROW (
    "First", MINX ( CALENDARAUTO (), [Date] ),
    "Last", MAXX ( CALENDARAUTO (), [Date] ),
    "Days", COUNTROWS ( CALENDARAUTO () )
)
FirstLastDays
2023-01-012033-12-314018

A financial year that ends in June

EVALUATE
ROW (
    "First", MINX ( CALENDARAUTO ( 6 ), [Date] ),
    "Last", MAXX ( CALENDARAUTO ( 6 ), [Date] )
)
FirstLast
2023-07-012033-06-30

CALENDAR, DATE, MIN, MAX.

Last updated · OpenBI Studio 0.3.74