<?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 Date comparison with addmonths in SET analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-comparison-with-addmonths-in-SET-analysis/m-p/1790715#M1210599</link>
    <description>&lt;P&gt;Good day experts,&lt;/P&gt;&lt;P&gt;I am trying to make a filter of client's activity based on their transactions for the 2 last month from reporting date (vReportingDate).&amp;nbsp;&amp;nbsp;I managed to write it without using a variable and it works fine:&lt;/P&gt;&lt;P class="p1"&gt;IF(AGGR(SUM({$&amp;lt;Day = {"&amp;gt;=01"}, Month = {"&amp;gt;=11"}, Year = {"&amp;gt;=2020"}&amp;gt;}[#Sum]), %IDClient)&amp;gt;0, 'active', 'inactive')&lt;/P&gt;&lt;P class="p1"&gt;But it is not working, when I am trying to implement the same filter with variable:&lt;/P&gt;&lt;P class="p1"&gt;IF(AGGR(SUM({$&amp;lt;Day = {"&amp;gt;=$(=Day(addmonths('$(vReportingDate)', -2)))"},&lt;BR /&gt;Month = {"&amp;gt;=$(=Month(addmonths('$(vReportingDate)', -2)))"},&lt;BR /&gt;Year = {"&amp;gt;=$(=Year(addmonths('$(vReportingDate)', -2)))"}&amp;gt;}[#Sum]), %IDClient)&amp;gt;0, 'active', 'inactive')&lt;/P&gt;&lt;P class="p1"&gt;It gives a wrong answer for vReportingDate = 01.01.2021&lt;/P&gt;&lt;P class="p1"&gt;I think it happens because of misuse date comparison, but I can't detect an error. I am very grateful for any assistance.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Mar 2021 21:56:26 GMT</pubDate>
    <dc:creator>KirDeg</dc:creator>
    <dc:date>2021-03-11T21:56:26Z</dc:date>
    <item>
      <title>Date comparison with addmonths in SET analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-comparison-with-addmonths-in-SET-analysis/m-p/1790715#M1210599</link>
      <description>&lt;P&gt;Good day experts,&lt;/P&gt;&lt;P&gt;I am trying to make a filter of client's activity based on their transactions for the 2 last month from reporting date (vReportingDate).&amp;nbsp;&amp;nbsp;I managed to write it without using a variable and it works fine:&lt;/P&gt;&lt;P class="p1"&gt;IF(AGGR(SUM({$&amp;lt;Day = {"&amp;gt;=01"}, Month = {"&amp;gt;=11"}, Year = {"&amp;gt;=2020"}&amp;gt;}[#Sum]), %IDClient)&amp;gt;0, 'active', 'inactive')&lt;/P&gt;&lt;P class="p1"&gt;But it is not working, when I am trying to implement the same filter with variable:&lt;/P&gt;&lt;P class="p1"&gt;IF(AGGR(SUM({$&amp;lt;Day = {"&amp;gt;=$(=Day(addmonths('$(vReportingDate)', -2)))"},&lt;BR /&gt;Month = {"&amp;gt;=$(=Month(addmonths('$(vReportingDate)', -2)))"},&lt;BR /&gt;Year = {"&amp;gt;=$(=Year(addmonths('$(vReportingDate)', -2)))"}&amp;gt;}[#Sum]), %IDClient)&amp;gt;0, 'active', 'inactive')&lt;/P&gt;&lt;P class="p1"&gt;It gives a wrong answer for vReportingDate = 01.01.2021&lt;/P&gt;&lt;P class="p1"&gt;I think it happens because of misuse date comparison, but I can't detect an error. I am very grateful for any assistance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 21:56:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-comparison-with-addmonths-in-SET-analysis/m-p/1790715#M1210599</guid>
      <dc:creator>KirDeg</dc:creator>
      <dc:date>2021-03-11T21:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date comparison with addmonths in SET analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-comparison-with-addmonths-in-SET-analysis/m-p/1790780#M1210607</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/137127"&gt;@KirDeg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of use Day, Month &amp;amp; Year, try with Date like below&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF(AGGR(SUM({$&amp;lt;DateField= {"&amp;gt;=$(=Date(MonthStart('$(vReportingDate)',-2),'YourDateFormat'))&amp;lt;=$(=Date('$(vReportingDate)','YourDateFormat'))"}&amp;gt;}[#Sum]), %IDClient)&amp;gt;0, 'active', 'inactive')&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 03:42:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-comparison-with-addmonths-in-SET-analysis/m-p/1790780#M1210607</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2021-03-12T03:42:45Z</dc:date>
    </item>
  </channel>
</rss>

