The Declare statement creates a definition for a field or group of fields. For example, Qlik Sense will automatically create extra fields whenever it finds a field containing dates. It automatically creates an autoCalendar using the Declare function.
Let's take a look at the code:
[autoCalendar]: DECLARE FIELD DEFINITION Tagged ('$date')FIELDS Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'), Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'), Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'), Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ...