<?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 Range using Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245768#M93656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent explanation Stefan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct, QlikView seems to try to interpret the condition.&amp;nbsp; In my case, I will be using min and max of the same date so I will always have a vaild range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jan 2012 16:45:25 GMT</pubDate>
    <dc:creator>john_duffy</dc:creator>
    <dc:date>2012-01-03T16:45:25Z</dc:date>
    <item>
      <title>Date Range using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245764#M93652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am looking for clarification on two expressions I have created to define a date range using set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached a sample application with the following two expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exp1 - Sum({$&amp;lt;Prod_Date = {"&amp;gt;=(=min(date(makedate(Ref_Year,Ref_Month,Ref_Day),'YYYY-MM-DD'))) &amp;lt;=$(=max(makedate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Ref_Year,Ref_Month,Ref_Day),'YYYY-MM-DD')))"}&amp;gt;} Product_Cnt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exp2 - Sum( {$&amp;lt;Prod_Date = {"&amp;gt;=$(min(date(makedate(Ref_Year,Ref_Month,Ref_Day),'YYYY-MM-DD')))"}&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;&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;lt;=$(max(date(makedate(Ref_Year,Ref_Month,Ref_Day),'YYYY-MM-DD)))"}&amp;gt;} Product_Cnt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the date range is valid (ie. data is between the min and max dates) both expresssions return the same results.&amp;nbsp; See charts Test1 and Test2 in the attached example.&lt;/P&gt;&lt;P&gt;If both the min and max dates are out of range, both expressions return the same results.&amp;nbsp; See chart Test5 in the attached example.&lt;/P&gt;&lt;P&gt;If the min and max dates don't form a proper range (ie. min &amp;gt; max), Exp1 seems to execute as &lt;STRONG&gt;&amp;gt;= min date &lt;SPAN style="text-decoration: underline;"&gt;or&lt;/SPAN&gt; &amp;lt;= max date&lt;/STRONG&gt;.&amp;nbsp; Exp2 executes as &lt;STRONG&gt;&amp;gt;= min date &lt;SPAN style="text-decoration: underline;"&gt;and&lt;/SPAN&gt; &amp;lt;= max date&lt;/STRONG&gt;.&amp;nbsp; Set charts Test3 and Test 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please explain why Exp1 seems to execute as &lt;STRONG&gt;&amp;gt;= min date &lt;SPAN style="text-decoration: underline;"&gt;and&lt;/SPAN&gt; &amp;lt;= max date&lt;/STRONG&gt; if min and max dates form a valid date range but &lt;STRONG&gt;&amp;gt;= min date &lt;SPAN style="text-decoration: underline;"&gt;or&lt;/SPAN&gt; &amp;lt;= max date &lt;/STRONG&gt;if min and max dates do not form a valid date range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exp2 always executes as &amp;gt;= min date and &amp;lt;= max date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John.&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;SPAN style="color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jan 2012 15:01:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245764#M93652</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2012-01-02T15:01:06Z</dc:date>
    </item>
    <item>
      <title>Date Range using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245765#M93653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am currently not able to look into your sample, but I think to remember that this is the standard "intelligent" way QV interprets your search expression, not only in set analysis but also in list box searches.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jan 2012 18:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245765#M93653</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-01-02T18:11:10Z</dc:date>
    </item>
    <item>
      <title>Date Range using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245766#M93654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks for the response.&amp;nbsp; Let me know if you are able to open the sample application.&amp;nbsp; I am using QV10 SR2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2012 12:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245766#M93654</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2012-01-03T12:52:38Z</dc:date>
    </item>
    <item>
      <title>Date Range using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245767#M93655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now had a short look into your app. As I tried to say, I think that the behaviour you've observed is kind of the "normal", "intelligent" way QV interprets your searches. For simplicity, assume we have a field with some numbers (like Dates in numerical representation).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you just click on the caption and start typing, you can enter &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;10&amp;lt;20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the search bar, this will return the values between 10 and 20 (excluding), like a AND: =if(Value&amp;gt;10 AND Value&amp;lt;20, Value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;20&amp;gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will do the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;10&amp;gt;20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will return the values lower than 10 OR larger than 20 ( =if(Value&amp;lt; 10 or Value &amp;gt; 20, Value) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess QV is really just trying to &lt;EM&gt;interpret &lt;/EM&gt;what the user intends, maximizing the circumstances where it will return ANYTHING. Note that we don't use any logical operator here, so QV may be free to guess ..&lt;/P&gt;&lt;P&gt;And as I believe, the search function is one of least/worst documented part in the software, so nobody can blaim on "different from documentation!" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result could get pretty much off from your expectations, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to enforce the AND condition, you could use it explicitely, something along the lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({$&amp;lt;Prod_Date = {&lt;STRONG&gt;"=Prod_Date&amp;gt;=$(=num(min(makedate(Ref_Year,Ref_Month,Ref_Day)))) and Prod_Date&amp;lt;=$(=num(max(date(makedate(Ref_Year-1,Ref_Month,Ref_Day)))))"&lt;/STRONG&gt;}&amp;gt;} Product_Cnt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for your example (or as you are already using: use intersection operator * for the element sets )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this answers your question.&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, 03 Jan 2012 16:08:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245767#M93655</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-01-03T16:08:17Z</dc:date>
    </item>
    <item>
      <title>Date Range using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245768#M93656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent explanation Stefan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct, QlikView seems to try to interpret the condition.&amp;nbsp; In my case, I will be using min and max of the same date so I will always have a vaild range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2012 16:45:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-Range-using-Set-Analysis/m-p/245768#M93656</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2012-01-03T16:45:25Z</dc:date>
    </item>
  </channel>
</rss>

