<?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 how to compare two date values stored in variables ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282870#M105149</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;Can you through some more light on the Date() function, so that I would not do the same mistake again.&lt;/P&gt;&lt;P&gt;I didn't got your point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Jul 2011 09:32:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-07-15T09:32:10Z</dc:date>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282864#M105143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to compare two date value stored in two variables.&lt;/P&gt;&lt;P&gt;This is what I am trying :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let curr_date= date(today(),'MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;LET PREV_DATE= DATE ('06/07/2011','MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;if date($(PREV_DATE)) &amp;lt; date($(curr_date))&lt;/P&gt;&lt;P&gt;let hilo= 1;&lt;/P&gt;&lt;P&gt;else &lt;/P&gt;&lt;P&gt;LET hilo=0;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to assign the value of variable hilo based up on this condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am getting error &lt;/P&gt;&lt;P&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Script line error: &lt;/P&gt;&lt;P&gt;if date(06/07/2011) &amp;lt; date(07/15/2011)&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Can anybody help me out and tell me how to do the comparison ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 08:31:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282864#M105143</guid>
      <dc:creator />
      <dc:date>2011-07-15T08:31:09Z</dc:date>
    </item>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282865#M105144</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;&amp;nbsp;&amp;nbsp; Try without date function. like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;let curr_date= date(today(),'MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;LET PREV_DATE= DATE ('06/07/2011','MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;if $(PREV_DATE) &amp;lt; $(curr_date)&lt;/P&gt;&lt;P&gt;let hilo= 1;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;LET hilo=0;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 08:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282865#M105144</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-07-15T08:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282866#M105145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are doing that in the script, the syntax needs the THEN keyword&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;IF Date($(PREV_DATE)) &amp;lt; Date($(curr_date)) THEN&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That should work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; text-decoration: underline; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 08:35:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282866#M105145</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-07-15T08:35:45Z</dc:date>
    </item>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282867#M105146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Use then after If expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e If condition then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 08:50:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282867#M105146</guid>
      <dc:creator />
      <dc:date>2011-07-15T08:50:24Z</dc:date>
    </item>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282868#M105147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank you all for you reply.&lt;/P&gt;&lt;P&gt;Sorry I forget to put then . &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have tried&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let curr_date= date(today(),'MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;LET PREV_DATE= DATE ('06/07/2011','MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;if date($(PREV_DATE),'MM/DD/YYYY') &amp;lt; date($(curr_date),'MM/DD/YYYY') then&lt;/P&gt;&lt;P&gt; let hilo= 1;&lt;/P&gt;&lt;P&gt; else &lt;/P&gt;&lt;P&gt; LET hilo=0;&lt;/P&gt;&lt;P&gt; end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But according to the logic the value of hilo must be 1.&lt;/P&gt;&lt;P&gt;But here I am getting value of hilo as 0.&lt;/P&gt;&lt;P&gt;can you explain what is the problem , or where am I going wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance !!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 09:04:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282868#M105147</guid>
      <dc:creator />
      <dc:date>2011-07-15T09:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282869#M105148</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;You are comparing dates, and dates as returned by the Date() function are literals, so you need to single quote them&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;IF '$(PREV_DATE)' &amp;lt; '$(curr_date)' THEN&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 09:25:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282869#M105148</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-07-15T09:25:48Z</dc:date>
    </item>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282870#M105149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;Can you through some more light on the Date() function, so that I would not do the same mistake again.&lt;/P&gt;&lt;P&gt;I didn't got your point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 09:32:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282870#M105149</guid>
      <dc:creator />
      <dc:date>2011-07-15T09:32:10Z</dc:date>
    </item>
    <item>
      <title>how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282871#M105150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Dear,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Correect syntax of if-else condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax is:- IF(&amp;lt;CONDITION&amp;gt;,&amp;lt;THEN EXPRESSION&amp;gt;,&amp;lt;ELSE EXPRESSION&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:- IF(DATE($(PREV_DATE)) &amp;lt; DATE($(CURR_DATE)) , LET hillo=1 , LET hillo=0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 09:38:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282871#M105150</guid>
      <dc:creator />
      <dc:date>2011-07-15T09:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare two date values stored in variables ?</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282872#M105151</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;It all has to do with the way QlikView uses variables and the difference bewteen LET and SET, and incidentally, dollar expansion. I posted about this some months ago, in &lt;A _jive_internal="true" href="https://community.qlik.com/message/109135#109135"&gt;this&lt;/A&gt; and &lt;A _jive_internal="true" href="https://community.qlik.com/message/93251#93251"&gt;this&lt;/A&gt; post (they came from the old Community, so I just have edited them to keep a readable format).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides, a Date() is a literal value, so when you refer to it in a conditional, you will not need to use quotes when it's not expanded, as in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;IF Date(PREV_DATE) &amp;lt; Date(curr_date) THEN&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because you are comparing equal formats (numeric formats, &lt;A _jive_internal="true" href="https://community.qlik.com/message/105584#105584"&gt;a date is evaluable as a numeric value in QlikView&lt;/A&gt;). When you expand (you use the $() so the values within are evaluated) and the result is a literal for example "15/07/2011", you do need to quote them&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;IF '$(PREV_DATE)' &amp;lt; '$(curr_date)' THEN&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check both for further information, and check the Reference Manual in this regard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense and helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 09:53:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-compare-two-date-values-stored-in-variables/m-p/282872#M105151</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-07-15T09:53:36Z</dc:date>
    </item>
  </channel>
</rss>

