<?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 Incorrect month order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501766#M187455</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two expressions calculating averages over 3 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first one calculates the average for the first 3 months:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Month={'&amp;gt;=$(=min(Month))&amp;lt;=$(=min(Month)+2)'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second one calculates the average for the last 3 months:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Month={'&amp;gt;=$(=max(Month)-2)&amp;lt;=$(=max(Month))'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the picture bellow you will notice that there are some anomalies&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="47126" alt="Example.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/47126_Example.png" style="width: 620px; height: 388px;" /&gt;&lt;/P&gt;&lt;P&gt;- For some reason it is calculating box A as the average for the last 3 months.&lt;/P&gt;&lt;P&gt;- It is also calculating box B as the average for the first 3 months.&lt;/P&gt;&lt;P&gt;- Ideally i would like it to calculate box C as the average for the first 3 months, and box D as the average for the last 3 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can you help me achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 08:17:11 GMT</pubDate>
    <dc:creator>cclayford</dc:creator>
    <dc:date>2013-10-02T08:17:11Z</dc:date>
    <item>
      <title>Incorrect month order</title>
      <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501766#M187455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two expressions calculating averages over 3 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first one calculates the average for the first 3 months:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Month={'&amp;gt;=$(=min(Month))&amp;lt;=$(=min(Month)+2)'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second one calculates the average for the last 3 months:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Month={'&amp;gt;=$(=max(Month)-2)&amp;lt;=$(=max(Month))'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the picture bellow you will notice that there are some anomalies&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="47126" alt="Example.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/47126_Example.png" style="width: 620px; height: 388px;" /&gt;&lt;/P&gt;&lt;P&gt;- For some reason it is calculating box A as the average for the last 3 months.&lt;/P&gt;&lt;P&gt;- It is also calculating box B as the average for the first 3 months.&lt;/P&gt;&lt;P&gt;- Ideally i would like it to calculate box C as the average for the first 3 months, and box D as the average for the last 3 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please can you help me achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 08:17:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501766#M187455</guid>
      <dc:creator>cclayford</dc:creator>
      <dc:date>2013-10-02T08:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect month order</title>
      <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501767#M187456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you attach the sample file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mukram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 10:07:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501767#M187456</guid>
      <dc:creator>mdmukramali</dc:creator>
      <dc:date>2013-10-02T10:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect month order</title>
      <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501768#M187457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it's calculating correctly the values for the first three months (Jan - Mar) and last 3 months (Oct - Dec).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume you want to get the first 3 YearMonths and last three YearMonths? Then use something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YearMonth={'&amp;gt;=$(=min(YearMonth))&amp;lt;=$(=addmonths(min(YearMonth),2))'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a YearMonth field in the script using e.g. MonthName() (but it seems you are already using a field like this).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 10:14:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501768#M187457</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-02T10:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect month order</title>
      <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501769#M187458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks swuehl, that worked!&lt;/P&gt;&lt;P&gt;Can you send me the expression for the last three months as well?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 11:14:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501769#M187458</guid>
      <dc:creator>cclayford</dc:creator>
      <dc:date>2013-10-02T11:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect month order</title>
      <link>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501770#M187459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pretty similar:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YearMonth={'&amp;gt;=$(=addmonths(max(YearMonth),-2))&amp;lt;=$(=max(YearMonth))'}&amp;gt;}[Total Units]) / 3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 11:21:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Incorrect-month-order/m-p/501770#M187459</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-02T11:21:07Z</dc:date>
    </item>
  </channel>
</rss>

