<?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 SET analysis with date comparision in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SET-analysis-with-date-comparision/m-p/1791793#M1210740</link>
    <description>&lt;P&gt;Hello People,&lt;/P&gt;&lt;P&gt;I have my measures written as below in a Table (for all 12 months separately). I want to use Date dimension (End of month for last 12 months) created using Calendar field to create following measure.&lt;/P&gt;&lt;P&gt;How can I achieve following&amp;nbsp; using set analysis ?&lt;/P&gt;&lt;P&gt;COUNT(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;[Invoice Hold Count] -= {0}&lt;BR /&gt;,[Payment Method] = {'Direct Debit'}&lt;BR /&gt;,[Invoice Hold Date] = {"&amp;lt;=$(=MonthEnd(AddMonths(today(),-12)))"}&lt;BR /&gt;,[Invoice Release Date] = {"&amp;gt;$(=MonthEnd(AddMonths(today(),-12)))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;[Invoice Number])&lt;/P&gt;&lt;P&gt;If I simply replace the date logic in expression above with Date field then it gives me null result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic I used to create Calendar -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let varMinDate = Num(Makedate(Year(Today())-1,Month(Today()),Day(Today())));&lt;BR /&gt;Let varMaxDate = Num(Makedate(Year(today()),Month(Today()),Day(Today())));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Datefield:&lt;BR /&gt;LOAD MonthEnd(date($(varMinDate)+IterNo()-1)) AS Datefield&lt;BR /&gt;AUTOGENERATE (1)&lt;BR /&gt;WHILE $(varMinDate)+IterNo()-1&amp;lt;= $(varMaxDate);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Calender:&lt;BR /&gt;LOAD&lt;BR /&gt;Datefield AS Date,&lt;BR /&gt;Year(Datefield) AS Year,&lt;BR /&gt;Month(Datefield) as Month,&lt;BR /&gt;Day(Datefield) AS Day,&lt;BR /&gt;'Q ' &amp;amp; Num(Ceil(Month(Datefield)/3),'(ROM)0') AS Quarter&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RESIDENT Datefield;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DROP TABLE Datefield;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Highly appreciate your help!&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 17 Mar 2021 09:18:26 GMT</pubDate>
    <dc:creator>SR2</dc:creator>
    <dc:date>2021-03-17T09:18:26Z</dc:date>
    <item>
      <title>SET analysis with date comparision</title>
      <link>https://community.qlik.com/t5/QlikView/SET-analysis-with-date-comparision/m-p/1791793#M1210740</link>
      <description>&lt;P&gt;Hello People,&lt;/P&gt;&lt;P&gt;I have my measures written as below in a Table (for all 12 months separately). I want to use Date dimension (End of month for last 12 months) created using Calendar field to create following measure.&lt;/P&gt;&lt;P&gt;How can I achieve following&amp;nbsp; using set analysis ?&lt;/P&gt;&lt;P&gt;COUNT(&lt;BR /&gt;{&amp;lt;&lt;BR /&gt;[Invoice Hold Count] -= {0}&lt;BR /&gt;,[Payment Method] = {'Direct Debit'}&lt;BR /&gt;,[Invoice Hold Date] = {"&amp;lt;=$(=MonthEnd(AddMonths(today(),-12)))"}&lt;BR /&gt;,[Invoice Release Date] = {"&amp;gt;$(=MonthEnd(AddMonths(today(),-12)))"}&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;[Invoice Number])&lt;/P&gt;&lt;P&gt;If I simply replace the date logic in expression above with Date field then it gives me null result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic I used to create Calendar -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let varMinDate = Num(Makedate(Year(Today())-1,Month(Today()),Day(Today())));&lt;BR /&gt;Let varMaxDate = Num(Makedate(Year(today()),Month(Today()),Day(Today())));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Datefield:&lt;BR /&gt;LOAD MonthEnd(date($(varMinDate)+IterNo()-1)) AS Datefield&lt;BR /&gt;AUTOGENERATE (1)&lt;BR /&gt;WHILE $(varMinDate)+IterNo()-1&amp;lt;= $(varMaxDate);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Calender:&lt;BR /&gt;LOAD&lt;BR /&gt;Datefield AS Date,&lt;BR /&gt;Year(Datefield) AS Year,&lt;BR /&gt;Month(Datefield) as Month,&lt;BR /&gt;Day(Datefield) AS Day,&lt;BR /&gt;'Q ' &amp;amp; Num(Ceil(Month(Datefield)/3),'(ROM)0') AS Quarter&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RESIDENT Datefield;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DROP TABLE Datefield;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Highly appreciate your help!&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 09:18:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SET-analysis-with-date-comparision/m-p/1791793#M1210740</guid>
      <dc:creator>SR2</dc:creator>
      <dc:date>2021-03-17T09:18:26Z</dc:date>
    </item>
  </channel>
</rss>

