<?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 and Dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443646#M487173</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 need to build functionality that enables the user to select one or more consecutive months (say June and July 2012) and we need to present 2 sets of results, one for the selected months (June and July 2012) and another that we can "&lt;STRONG&gt;Previous Year&lt;/STRONG&gt;" that shows the results for the same period in the previous year (June and July 2011 in this example) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my dataset I created a Master Calendar that includes a field called &lt;STRONG&gt;MonthID &lt;/STRONG&gt;which is the month number staring from "1" for the oldest month and incremented by 1 for every month after that, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 25%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;Date&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;MonthID&lt;BR /&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/1/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;10/2/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;11/3/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/6/2011&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;54&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/6/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;66&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/7/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;67&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/12/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;72&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using Set Analysis to calculate the the "&lt;STRONG&gt;PreviousYear&lt;/STRONG&gt;"&amp;nbsp; which works for almost all scenaria except in the case where a December (Any December) is the month selected (or the minimum of the months selected (e.g. December 2012 and January 2013)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(=min(MonthID) - 12)"}, &lt;/P&gt;&lt;P&gt;Date = {"&amp;lt;$(=Date(MakeDate(Year(Max(Date))-1, Month(Max(Date))+1, 1),'DD/MM/YYYY'))"},&lt;/P&gt;&lt;P&gt;Year = ,&lt;/P&gt;&lt;P&gt;Quarter = ,&lt;/P&gt;&lt;P&gt;Period = ,&lt;/P&gt;&lt;P&gt;[Period (#)] = ,&lt;/P&gt;&lt;P&gt;Month = &amp;gt;} &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To see how the above works, assume that June and July 2012 was chosen:&lt;/P&gt;&lt;P&gt;The above set analysis will generate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;MonthID&lt;/STRONG&gt; &amp;gt;= min(MonthID) -12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID &amp;gt;=66-12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID&amp;gt;=54&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Also, the 2nd line of my set analysis generates:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt; &amp;lt; MakeDate(2011, 8, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Date &amp;lt; 1/8/2011&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so to get the data for "&lt;STRONG&gt;PreviousYear&lt;/STRONG&gt;" for the selected range of June and July 2012:&lt;/P&gt;&lt;P&gt;MonthID &amp;gt;= 54&lt;/P&gt;&lt;P&gt;Date &amp;lt; 1/8/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROBLEM:&lt;/P&gt;&lt;P&gt;If the user selects December 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;MonthID&lt;/STRONG&gt; &amp;gt;= min(MonthID) -12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID &amp;gt;=72-12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID&amp;gt;=60&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt; &amp;lt; MakeDate(2011, 13, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;an invalid date as there is no month 13!!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me get 1/1/2012 and the maximum date for the above so that the data set will be based on:&lt;/P&gt;&lt;P&gt;MonthID &amp;gt;= 60&lt;/P&gt;&lt;P&gt;Date &amp;lt; 1/1/2012&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Feb 2013 23:15:01 GMT</pubDate>
    <dc:creator>alexis</dc:creator>
    <dc:date>2013-02-17T23:15:01Z</dc:date>
    <item>
      <title>Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443646#M487173</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 need to build functionality that enables the user to select one or more consecutive months (say June and July 2012) and we need to present 2 sets of results, one for the selected months (June and July 2012) and another that we can "&lt;STRONG&gt;Previous Year&lt;/STRONG&gt;" that shows the results for the same period in the previous year (June and July 2011 in this example) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my dataset I created a Master Calendar that includes a field called &lt;STRONG&gt;MonthID &lt;/STRONG&gt;which is the month number staring from "1" for the oldest month and incremented by 1 for every month after that, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 25%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;Date&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;MonthID&lt;BR /&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/1/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;10/2/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;11/3/2006&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/6/2011&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;54&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/6/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;66&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/7/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;67&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="text-align: center;"&gt;1/12/2012&lt;/TD&gt;&lt;TD style="text-align: center;"&gt;72&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using Set Analysis to calculate the the "&lt;STRONG&gt;PreviousYear&lt;/STRONG&gt;"&amp;nbsp; which works for almost all scenaria except in the case where a December (Any December) is the month selected (or the minimum of the months selected (e.g. December 2012 and January 2013)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(=min(MonthID) - 12)"}, &lt;/P&gt;&lt;P&gt;Date = {"&amp;lt;$(=Date(MakeDate(Year(Max(Date))-1, Month(Max(Date))+1, 1),'DD/MM/YYYY'))"},&lt;/P&gt;&lt;P&gt;Year = ,&lt;/P&gt;&lt;P&gt;Quarter = ,&lt;/P&gt;&lt;P&gt;Period = ,&lt;/P&gt;&lt;P&gt;[Period (#)] = ,&lt;/P&gt;&lt;P&gt;Month = &amp;gt;} &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To see how the above works, assume that June and July 2012 was chosen:&lt;/P&gt;&lt;P&gt;The above set analysis will generate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;MonthID&lt;/STRONG&gt; &amp;gt;= min(MonthID) -12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID &amp;gt;=66-12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID&amp;gt;=54&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Also, the 2nd line of my set analysis generates:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt; &amp;lt; MakeDate(2011, 8, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Date &amp;lt; 1/8/2011&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so to get the data for "&lt;STRONG&gt;PreviousYear&lt;/STRONG&gt;" for the selected range of June and July 2012:&lt;/P&gt;&lt;P&gt;MonthID &amp;gt;= 54&lt;/P&gt;&lt;P&gt;Date &amp;lt; 1/8/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROBLEM:&lt;/P&gt;&lt;P&gt;If the user selects December 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;MonthID&lt;/STRONG&gt; &amp;gt;= min(MonthID) -12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID &amp;gt;=72-12&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;MonthID&amp;gt;=60&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;and &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt; &amp;lt; MakeDate(2011, 13, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which is &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;an invalid date as there is no month 13!!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me get 1/1/2012 and the maximum date for the above so that the data set will be based on:&lt;/P&gt;&lt;P&gt;MonthID &amp;gt;= 60&lt;/P&gt;&lt;P&gt;Date &amp;lt; 1/1/2012&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 23:15:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443646#M487173</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2013-02-17T23:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443647#M487174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using a MonthID, I think you should be able to use only an advanced search in Date field, using an lower as well as an upper limit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But coming back to your initial request, try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Date = {"&amp;lt;$(=Date(addmonths(monthstart(Max(Date)),-11),'DD/MM/YYYY'))"}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 00:22:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443647#M487174</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-18T00:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443648#M487175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi swuehl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your suggestion was very helpful indeed as it calculates correctly the "Date" part as 1/1/2012 in the case described above. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That alone however does not generate the right result because it does not have a lower limit which was the reason I introduced the MonthID concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just so that you have the complete story, the formula in question is stored in a variable (say "vSetPreviousYear)) and in my chart I simply say:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= Sum($(vSetPreviousYear) Sales) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you assist to complete the formula to cater for the correct range .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 02:17:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443648#M487175</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2013-02-18T02:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443649#M487176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alexis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please check&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Month(Max(Date))+1&lt;/SPAN&gt; will not be 13. it will be next month to the Max(Date).&lt;/P&gt;&lt;P&gt;IF Max of date is 'dec' then &lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Month(Max(Date))+1&lt;/SPAN&gt; will be Jan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I.e) MakeDate(2012,month(12)+1,1)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 06:35:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443649#M487176</guid>
      <dc:creator />
      <dc:date>2013-02-18T06:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443650#M487177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sampath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for responding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it's my fault for not explaining the exact requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the user selects the range:&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;June2012 - August 2012&lt;/STRONG&gt; then the result should be all data for the range &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;June 2011 - August 2011&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Likewise, if they select:&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;Dec 2012&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;then the resultset should comprisedata for &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dec 2011&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The previous respondent dealt with the issue of a December selection where my formula:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Date = {"&amp;lt;$(=Date(MakeDate(Year(Max(Date))-1, Month(Max(Date))+1, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;was flawed because in the case of December it was attempting to calculate Date &amp;lt;= 1/13/yyyyy &lt;/P&gt;&lt;P&gt;As you rightly state there is no such thing as month 13!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;swuehl&lt;/SPAN&gt;'s response takes care of the &lt;SPAN style="text-decoration: underline;"&gt;upper limit&lt;/SPAN&gt; for the data set - using his suggestion on its own:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Date = {"&amp;lt;$(=Date(addmonths(monthstart(Max(Date)),-11),'DD/MM/YYYY'))"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;will return (in the case of a &lt;EM&gt;December 2012&lt;/EM&gt; selection for example) data that meets the criterion:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #737373; background-color: #ffffff; font-family: Arial;"&gt;data &amp;lt; 1/1/2012 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;This is incomplete as we are interested in:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;1/12/2011 &amp;lt;= data &amp;lt; 1/1/2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What we are missing is the &lt;SPAN style="text-decoration: underline;"&gt;lower limit&lt;/SPAN&gt; of the dataset and that is why, in my original formula I introduced the concept of MonthID (see my original post).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be honest, the simplest way to resolve this is to finetune my original definition (see below) and just base the selection by extending the MonthID line to read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Month ID &amp;gt;=min(MonthID)-12 &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MonthID &amp;lt;max(MonthID)-11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I am missing the part in bold above)..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;[code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(=min(MonthID) - 12)"},&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Date = {"&amp;lt;$(=Date(MakeDate(Year(Max(Date))-1, Month(Max(Date))+1, 1),'DD/MM/YYYY'))"},&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Year = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Quarter = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Period = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;[Period (#)] = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Month = &amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;[/code]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 08:58:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443650#M487177</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2013-02-18T08:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443651#M487178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;If you want to show only a single value as result and not results per month then try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(=min(MonthID) - 12)&amp;lt;=&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;$(=max(MonthID) - 12)&lt;/SPAN&gt;"},&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Date =, &lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Year = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Quarter = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Period = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;[Period (#)] = ,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Month = &amp;gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 09:06:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443651#M487178</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-18T09:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443652#M487179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanx - that works - in the end by explaining the problem made me realise that it was much simpler!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 09:15:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-and-Dates/m-p/443652#M487179</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2013-02-18T09:15:27Z</dc:date>
    </item>
  </channel>
</rss>

