<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Are there any known bugs when using autoCalendar fields in Set Analysis expressions within AGGR in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Are-there-any-known-bugs-when-using-autoCalendar-fields-in-Set/m-p/1575127#M62940</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I've read your data set, and I don't think you should have any problem using aggr functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Salutations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Apr 2019 14:40:17 GMT</pubDate>
    <dc:creator>christian77</dc:creator>
    <dc:date>2019-04-30T14:40:17Z</dc:date>
    <item>
      <title>Are there any known bugs when using autoCalendar fields in Set Analysis expressions within AGGR ???</title>
      <link>https://community.qlik.com/t5/App-Development/Are-there-any-known-bugs-when-using-autoCalendar-fields-in-Set/m-p/1564848#M62939</link>
      <description>&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;I am trying to use a Set Analysis expression within the inner aggregation function of an aggr().&amp;nbsp;&amp;nbsp; When I use a regular field the expression works.&amp;nbsp; But, if I substitute the regular field for an autoCalendar field, the expression fails.&lt;/P&gt;&lt;P&gt;These are the expressions using the regular field and then the same expressions using the autoCalendar generated field:&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Sales Current Month (using regular field):&amp;nbsp; &lt;/STRONG&gt;Sum({$&amp;lt;Month = {$(=max(Month))} &amp;gt;} Amount)&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Avg Sales Prev Month (using regular field):&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;Avg( aggr(sum({$&amp;lt;Month -= {$(=max(Month))}&amp;gt;} Amount), Month, Store))&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Both expressions above work fine.&amp;nbsp; However, only the first of the next two expressions works:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Sales Current Month (using autoCalendar field): &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Sum({$&amp;lt;[Date.autoCalendar.NumMonth] = {$(=max([Date.autoCalendar.NumMonth]))} &amp;gt;} Amount)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;Avg Sales Prev Months (using autoCalendar field):&lt;/STRONG&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Avg( aggr(sum({$&amp;lt;[Date.autoCalendar.NumMonth] -= {$(=max([Date.autoCalendar.NumMonth]))}&amp;gt;} Amount), [Date.autoCalendar.NumMonth], Store))&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;In my autoCalendar, &lt;EM&gt;NumMonth&lt;/EM&gt; is defined as:&amp;nbsp; "Num(Month($1)) as NumMonth Tagged ('$month', '$cyclic')".&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As can be seen in the img bellow, the expression for &lt;EM&gt;Avg Sales Prev Months&lt;/EM&gt; (shown as a red diamond) doesn't work when using the derived field Date.autoCalendar.NumMonth instead of the Month field:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Comparison of vis with and without autoCalendar fields.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/9431i84ABC6047CE7D94A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Comparison of vis with and without autoCalendar fields.PNG" alt="Comparison of vis with and without autoCalendar fields.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;I am wondering if there are any known bugs / limitations in using derived fields inside a Set Analysis expression in an inner aggregation function of an aggr()&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;Any ideas?&amp;nbsp; &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;--José&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;PS:&amp;nbsp; Bellow is the script I used&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;load *, num(month(Date)) as Month;&lt;BR /&gt;Load * inline [&lt;BR /&gt;Store, Amount, Date&lt;BR /&gt;T1, 120, 1/1/2019&lt;BR /&gt;T1, 100, 1/1/2019&lt;BR /&gt;T1, 140, 1/1/2019&lt;BR /&gt;T1, 130, 2/1/2019&lt;BR /&gt;T1, 100, 2/1/2019&lt;BR /&gt;T1, 120, 2/1/2019&lt;BR /&gt;T1, 80, 3/1/2019&lt;BR /&gt;T1, 60, 3/1/2019&lt;BR /&gt;T1, 120, 3/1/2019&lt;BR /&gt;T1, 150, 4/1/2019&lt;BR /&gt;T1, 120, 4/1/2019&lt;BR /&gt;T1, 130, 4/1/2019&lt;BR /&gt;T1, 80, 5/1/2019&lt;BR /&gt;T1, 120, 5/1/2019&lt;BR /&gt;T1, 110, 5/1/2019&lt;BR /&gt;T1, 110, 6/1/2019&lt;BR /&gt;T1, 150, 6/1/2019&lt;BR /&gt;T1, 120, 6/1/2019&lt;BR /&gt;T1, 160, 7/1/2019&lt;BR /&gt;T1, 180, 7/1/2019&lt;BR /&gt;T1, 120, 7/1/2019&lt;BR /&gt;T1, 200, 8/1/2019&lt;BR /&gt;T1, 100, 8/1/2019&lt;BR /&gt;T1, 140, 8/1/2019&lt;BR /&gt;T1, 60, 9/1/2019&lt;BR /&gt;T1, 70, 9/1/2019&lt;BR /&gt;T1, 80, 9/1/2019&lt;BR /&gt;T1, 90, 10/1/2019&lt;BR /&gt;T1, 170, 10/1/2019&lt;BR /&gt;T1, 150, 10/1/2019&lt;BR /&gt;T1, 20, 11/1/2019&lt;BR /&gt;T1, 40, 11/1/2019&lt;BR /&gt;T1, 50, 11/1/2019&lt;BR /&gt;T1, 300, 12/1/2019&lt;BR /&gt;T1, 140, 12/1/2019&lt;BR /&gt;T1, 180, 12/1/2019&lt;BR /&gt;T2, 30, 1/1/2019&lt;BR /&gt;T2, 230, 2/1/2019&lt;BR /&gt;T2, 180, 3/1/2019&lt;BR /&gt;T2, 120, 4/1/2019&lt;BR /&gt;T2, 20, 5/1/2019&lt;BR /&gt;T2, 100, 6/1/2019&lt;BR /&gt;T2, 190, 7/1/2019&lt;BR /&gt;T2, 210, 8/1/2019&lt;BR /&gt;T2, 100, 9/1/2019&lt;BR /&gt;T2, 160, 10/1/2019&lt;BR /&gt;T2, 70, 11/1/2019&lt;BR /&gt;T2, 90, 12/1/2019&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;[autoCalendar]:&lt;BR /&gt;DECLARE FIELD DEFINITION Tagged ('$date')&lt;BR /&gt;FIELDS&lt;BR /&gt;Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),&lt;BR /&gt;Month($1) AS [Month] Tagged ('$month', '$cyclic'),&lt;BR /&gt;Num(Month($1)) as NumMonth Tagged ('$month', '$cyclic'),&lt;BR /&gt;Day($1) as Day Tagged ('$day', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-'&amp;amp;Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),&lt;BR /&gt;Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),&lt;BR /&gt;Dual('W'&amp;amp;Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),&lt;BR /&gt;Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),&lt;BR /&gt;Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),&lt;BR /&gt;If (DayNumberOfYear($1) &amp;lt;= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,&lt;BR /&gt;Year(Today())-Year($1) AS [YearsAgo] ,&lt;BR /&gt;If (DayNumberOfQuarter($1) &amp;lt;= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,&lt;BR /&gt;4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,&lt;BR /&gt;Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,&lt;BR /&gt;If(Day($1)&amp;lt;=Day(Today()),1,0) AS [InMTD] ,&lt;BR /&gt;12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,&lt;BR /&gt;Month(Today())-Month($1) AS [MonthRelNo] ,&lt;BR /&gt;If(WeekDay($1)&amp;lt;=WeekDay(Today()),1,0) AS [InWTD] ,&lt;BR /&gt;(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,&lt;BR /&gt;Week(Today())-Week($1) AS [WeekRelNo] ;&lt;/P&gt;&lt;P&gt;DERIVE FIELDS FROM FIELDS [Date] USING [autoCalendar] ;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 Dec 2021 22:04:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Are-there-any-known-bugs-when-using-autoCalendar-fields-in-Set/m-p/1564848#M62939</guid>
      <dc:creator>diagonjope</dc:creator>
      <dc:date>2021-12-21T22:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Are there any known bugs when using autoCalendar fields in Set Analysis expressions within AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Are-there-any-known-bugs-when-using-autoCalendar-fields-in-Set/m-p/1575127#M62940</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I've read your data set, and I don't think you should have any problem using aggr functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Salutations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 14:40:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Are-there-any-known-bugs-when-using-autoCalendar-fields-in-Set/m-p/1575127#M62940</guid>
      <dc:creator>christian77</dc:creator>
      <dc:date>2019-04-30T14:40:17Z</dc:date>
    </item>
  </channel>
</rss>

