<?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 Re: Set Analysis - can you spot the error in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385067#M143817</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry haven't noticed the bracket... so that&lt;/P&gt;&lt;P&gt;2*min(MonthID) - max(MonthID) - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the string&lt;/P&gt;&lt;P&gt;"&amp;lt;$(=Date(MakeDate(Min(Year), Min([Month (#)]), 1)&lt;SPAN style="text-decoration: line-through;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;,'DD/MM/YYYY'))"&lt;/P&gt;&lt;P&gt;you have&amp;nbsp; 6 open and 7 closing brackets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2012 17:12:40 GMT</pubDate>
    <dc:creator>whiteline</dc:creator>
    <dc:date>2012-09-06T17:12:40Z</dc:date>
    <item>
      <title>Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385064#M143814</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'm creating a group of variables to contain the formulae for some point-in-time requirements. &lt;/P&gt;&lt;P&gt;All variables except one (see below) work and I am sure it's a syntax issue as all fields etc are OK. Can you help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is one that works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Variable&lt;/SPAN&gt;: &lt;EM&gt;vSetYTD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Comment&lt;/SPAN&gt;: All YTD Sales; MonthID is an incremental ID for all data in my data set. My application comprises "Sales" table and a master calendar - the 2 tables are associated via "Date" field&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Usage&lt;/SPAN&gt;: In my chart I use it as an expression e.g. &lt;EM&gt;Sum($(vSetYTD) Sales)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Definition&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;{$&amp;lt;MonthID = {"&amp;lt;=$(=Max(MonthID))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Date = {"&amp;lt;=$(=Max(Date))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Year = {$(=Max(Year))},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Quarter = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Period = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;[Period (#)] = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Month = &amp;gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THE FOLLOWING DOES NOT WORK:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Variable&lt;/SPAN&gt;: &lt;EM&gt;vSetPreviousPeriod&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Comment&lt;/SPAN&gt;: All Sales for the period previous to that selected. For example if they select May2012 and June2012 this should return March2012 and April2012 sales. The user can select 1 or more consecutive &lt;SPAN style="text-decoration: underline;"&gt;months&lt;/SPAN&gt;. I am trying to return data whose MonthID is &amp;gt;= to (MinimumID - ((MaximumID - MinimumID) + 1) and less than MinimumID,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Example&lt;/SPAN&gt;: Suppose the ID for April2012 is 23, May2012 is 24 and June2012 is 25 then I want to return Sales data for the months whose IDs are 20, 21 and 22 (i.e. Jan2012, Feb2012 and March2012).&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Usage&lt;/SPAN&gt;: In my chart I use it as an expression e.g. &lt;EM&gt;Sum($(vSetPreviousPeriod) Sales)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Definition&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(min(MonthID) - (Max(MonthID) - Min(MonthID) + 1))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Date = {"&amp;lt;$(=Date(MakeDate(Min(Year), Min([Month (#)]), 1)),'DD/MM/YYYY'))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Year = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Quarter = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Period = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;[Period (#)] = ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;Month = &amp;gt;} &lt;/SPAN&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;ANY HELP would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 15:12:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385064#M143814</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2012-09-06T15:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385065#M143815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;min(MonthID)&lt;/STRONG&gt; - (Max(MonthID) &lt;STRONG&gt;- Min(MonthID) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;what is the point ? it (bold) equals sero.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 15:37:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385065#M143815</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-06T15:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385066#M143816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for responding to my thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In response to your posting I would say, in the first instance to look at the brackets but I thinks it's easier to explain with an example and then we can see if there are ways of simplifying the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My months in my Calendar have a "MonthID", ranging from "1" for the oldest set to whatever for the latest, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MONTH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MonthID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Jan2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;Feb2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Jan2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&lt;/P&gt;&lt;P&gt;Feb2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/P&gt;&lt;P&gt;Mar2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;Apr2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&lt;/P&gt;&lt;P&gt;May2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17&lt;/P&gt;&lt;P&gt;Jun2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&lt;/P&gt;&lt;P&gt;Jul2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19 etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I present these months in a listbox and I allow the user to select &lt;SPAN style="text-decoration: underline;"&gt;one&lt;/SPAN&gt; of them or a &lt;SPAN style="text-decoration: underline;"&gt;range&lt;/SPAN&gt; of conscutive dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's suppose they have chosen the range &lt;STRONG&gt;Apr2012, May2012&lt;/STRONG&gt; and &lt;STRONG&gt;June2012&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The requirement is for a chart showing Sales for the &lt;SPAN style="text-decoration: underline;"&gt;previous period&lt;/SPAN&gt; which in this instance would be &lt;STRONG&gt;Jan2012&lt;/STRONG&gt;, &lt;STRONG&gt;Feb2012&lt;/STRONG&gt; and &lt;STRONG&gt;March2012&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;min(MonthID)&lt;/STRONG&gt; would be &lt;STRONG&gt;16&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;max(MonthID)&lt;/STRONG&gt; would be &lt;STRONG&gt;18&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I want to see sales for the MonthID range of 13 through to 15.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula min(MonthID) - ((max(MonthID) - min(MonthID)) +1)) returns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 16 - ((18-16) + 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 16 - 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = &lt;STRONG&gt;13&lt;/STRONG&gt; which is the start of the MonthID that I am interested&lt;/P&gt;&lt;P&gt;The maximum MonthID that I am interested is one less than the smallest selected (i.e. &lt;STRONG&gt;15&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would welcome all suggestions of how this can be achieved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 16:17:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385066#M143816</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2012-09-06T16:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385067#M143817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry haven't noticed the bracket... so that&lt;/P&gt;&lt;P&gt;2*min(MonthID) - max(MonthID) - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the string&lt;/P&gt;&lt;P&gt;"&amp;lt;$(=Date(MakeDate(Min(Year), Min([Month (#)]), 1)&lt;SPAN style="text-decoration: line-through;"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;,'DD/MM/YYYY'))"&lt;/P&gt;&lt;P&gt;you have&amp;nbsp; 6 open and 7 closing brackets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 17:12:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385067#M143817</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-06T17:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385068#M143818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well spotted regarding the extra bracket. At least now I am getting "something" on the chart (see below) with the corrected formula of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(min(MonthID) - (Max(MonthID) - Min(MonthID) + 1))"},&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date = {"&amp;lt;$(=Date(MakeDate(Min(Year), Min([Month (#)]), 1),'DD/MM/YYYY'))"},&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Year = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Quarter = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Period = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[Period (#)] = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Month = &amp;gt;} &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see in the chart below, I selected MonthIDs 25,26 and 27 and should be getting MonthIDs of 22, 23 and 24 as "previous period" - it is almost as if the "MonthID&amp;gt;=" part of the expression above is being ignored and only the "Date&amp;lt;" part is being actioned. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21475" class="jive-image-thumbnail jive-image" onclick="" alt="test1.jpg" src="https://community.qlik.com/legacyfs/online/21475_test1.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 04:23:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385068#M143818</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2012-09-07T04:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - can you spot the error</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385069#M143819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the formula:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{$&amp;lt;MonthID = {"&amp;gt;=$(&lt;STRONG&gt;=&lt;/STRONG&gt;min(MonthID) - (Max(MonthID) - Min(MonthID) + 1))"},&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date = {"&amp;lt;$(=Date(MakeDate(Min(Year), Min([Month (#)]), 1),'DD/MM/YYYY'))"},&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Year = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Quarter = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Period = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[Period (#)] = ,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Month = &amp;gt;} &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the "=" sign was missing in the first line just after the $ sign - &lt;/P&gt;&lt;P&gt;i.e. it was &lt;/P&gt;&lt;P&gt;&lt;EM&gt;{"&amp;gt;=$(min(MonthID)&lt;/EM&gt; instead of&lt;/P&gt;&lt;P&gt;&lt;EM&gt;{"&amp;gt;=$(&lt;STRONG&gt;=&lt;/STRONG&gt;min(MonthID)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks for your help &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Alexis&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 04:52:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-can-you-spot-the-error/m-p/385069#M143819</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2012-09-07T04:52:31Z</dc:date>
    </item>
  </channel>
</rss>

