title: How does the QlikSense AutoCalendar function work?
body: <p>Taking apart the auto-generated code in one of my Sense Apps, I have come across the Auto Calendar function which is great and I have amended as below but I have no idea how it works! Can someone provide some documentation?</p>
  
  <pre><code>[autoCalendar]: 
    DECLARE FIELD DEFINITION Tagged ('$date')
  FIELDS
    Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year')
    ,Dual('Q'&amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter')
    ,Dual(Year($1)&amp;'-Q'&amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$axis', '$yearquarter')
    ,Month($1) AS [Month] Tagged ('$month')
    ,Dual(Year($1)&amp;'-'&amp;Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth')
    ,Dual('W'&amp;Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber')
    ,Date(Floor($1)) AS [Date] Tagged ('$date')
    /*User added date components*/
    ,Dual(Year($1), if(Year($1)=Year(today()),YearStart($1),null)) AS [ThisYear] Tagged ('$axis', '$thisyear')
    ,Dual(Year($1)&amp;'-Q'&amp;Num(Ceil(Num(Month($1))/3)), if(Year($1)=Year(today()),QuarterStart($1),null)) AS [ThisYearQuarter] Tagged ('$axis', '$thisyearquarter')
    ,Dual(Year($1)&amp;'-'&amp;Month($1), if(Year($1)=Year(today()), monthstart($1),null)) AS [ThisYearMonth] Tagged ('$axis', '$thisyearmonth')
    ,Dual(Year($1), if(Year($1)=(Year(today())-1),YearStart($1),null)) AS [LastYear] Tagged ('$axis', '$lastyear')
    ,Dual(Year($1)&amp;'-Q'&amp;Num(Ceil(Num(Month($1))/3)), if(Year($1)=(Year(today())-1),QuarterStart($1),null)) AS [LastYearQuarter] Tagged ('$axis', '$lastyearquarter')
    ,Dual(Year($1)&amp;'-'&amp;Month($1), if(Year($1)=(Year(today())-1), monthstart($1),null)) AS [LastYearMonth] Tagged ('$axis', '$lastyearmonth')
   ;
  
  
  DERIVE FIELDS FROM FIELDS [StartDate] USING [autoCalendar] ;
  </code></pre>
  
  <p>Does this iterate through every entry or does it iterate through every day in the calendar? It looks to me like the former - can it be used for non-date functions?</p>