<?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 of a Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305016#M495689</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to compare results from the month prior to my current selections. I have used set analysis to do this quite effectively for YEAR which is a number. My attempts to do the same thing with POST_MONTH, which is the monthstart in date format, have repeatedly failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works for YEAR:&lt;BR /&gt;sum({$&amp;lt;YEAR={$(=only(YEAR)-1)}&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code returns the previous month date that I am interested in:&lt;BR /&gt;ADDMONTHS(POST_MONTH,-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read many posts here and tried dozens of different ways. How can I successfully combine the two?&lt;BR /&gt;Thank you.&lt;BR /&gt;Jared&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Feb 2012 17:18:49 GMT</pubDate>
    <dc:creator>jrothfuss</dc:creator>
    <dc:date>2012-02-21T17:18:49Z</dc:date>
    <item>
      <title>Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305016#M495689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to compare results from the month prior to my current selections. I have used set analysis to do this quite effectively for YEAR which is a number. My attempts to do the same thing with POST_MONTH, which is the monthstart in date format, have repeatedly failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works for YEAR:&lt;BR /&gt;sum({$&amp;lt;YEAR={$(=only(YEAR)-1)}&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code returns the previous month date that I am interested in:&lt;BR /&gt;ADDMONTHS(POST_MONTH,-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read many posts here and tried dozens of different ways. How can I successfully combine the two?&lt;BR /&gt;Thank you.&lt;BR /&gt;Jared&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 17:18:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305016#M495689</guid>
      <dc:creator>jrothfuss</dc:creator>
      <dc:date>2012-02-21T17:18:49Z</dc:date>
    </item>
    <item>
      <title>Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305017#M495691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;YEAR={$(=only(YEAR)-1)}, POST_MONTH={$(=&lt;SPAN style="font-size: 8pt;"&gt;ADDMONTHS(POST_MONTH,-1)&lt;/SPAN&gt;)}&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 17:25:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305017#M495691</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-21T17:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305018#M495694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for taking a look at this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That expression returned null. Also, in this case I don't need the prior year... just the prior month (which would be the prior year when January is selected).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this too (just removing the YEAR part of the expression) and it also returned null:&lt;BR /&gt;sum({$&amp;lt;POST_MONTH={$(=ADDMONTHS(POST_MONTH,-1))}&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 17:36:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305018#M495694</guid>
      <dc:creator>jrothfuss</dc:creator>
      <dc:date>2012-02-21T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305019#M495695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can define a variable vMaxDate as Max(date) if you have a date field. Otherwise as makeDate(Max(Year), Max(POST_MONTH), 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year = { '$(= Year(AddMonths($(vMaxDate)), -1))' }, POST_MONTH = { '$(= Month(AddMonths($(vMaxDate)), -1))'} &amp;gt;} AMOUNT)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 17:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305019#M495695</guid>
      <dc:creator />
      <dc:date>2012-02-21T17:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305020#M495696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. I should probably define my question better.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In theory this expression should return the sum(AMOUNT) for the month prior to the selection, but it returns the current month value instead:&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;POST_MONTH={"=$(=addmonths(only(POST_MONTH),-1))"}&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have attached a qvw with a working example, the blue chart has the expression in it that needs help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 20:40:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305020#M495696</guid>
      <dc:creator>jrothfuss</dc:creator>
      <dc:date>2012-02-21T20:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305021#M495697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;POST_MONTH={'$(=addmonths(only(POST_MONTH),-1))'},Year=&amp;gt;}AMOUNT)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ,Year= part is only necessary if your users may select also from year. If they would, the selection in Year and your new set POST_MONTH would get incompatible, so you need to clear the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 20:52:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305021#M495697</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-21T20:52:43Z</dc:date>
    </item>
    <item>
      <title>Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305022#M495698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;YEAR=, POST_MONTH={$(=Month(&lt;SPAN style="font-size: 8pt;"&gt;ADDMONTHS(POST_MONTH,-1))&lt;/SPAN&gt;)}&amp;gt;} AMOUNT)\\use this If Post_Month has month as jan,feb like that if not then look at below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;YEAR=, POST_MONTH={"&amp;gt;=$(=MonthStart(&lt;SPAN style="font-size: 8pt;"&gt;ADDMONTHS(POST_MONTH,-1))&lt;/SPAN&gt;)&amp;lt;=&lt;/P&gt;&lt;P&gt;$(=MonthEnd(&lt;SPAN style="font-size: 8pt;"&gt;ADDMONTHS(POST_MONTH,-1))&lt;/SPAN&gt;)}&amp;gt;} AMOUNT)\\use this if it is a date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt; Hope it helps&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 04:30:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305022#M495698</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-22T04:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305023#M495699</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;Please refer to attachment.&lt;/P&gt;&lt;P&gt;Is it this that you were searching for?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 05:04:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305023#M495699</guid>
      <dc:creator />
      <dc:date>2012-02-22T05:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis of a Date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305024#M495700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I chose to use the code recommended by swuehl because it was the shortest, Celambarasan's code did work too. Thanks again to all each of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 22:58:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-of-a-Date/m-p/305024#M495700</guid>
      <dc:creator>jrothfuss</dc:creator>
      <dc:date>2012-02-24T22:58:32Z</dc:date>
    </item>
  </channel>
</rss>

