<?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 problem with QlikView variables!!! in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296372#M109928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I got a bar chart with the following expressions: ﻿&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PeriodDate = {"&amp;lt;=$(=vPeriodDate) &amp;gt;=$(=vStartYear)&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount)/1500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on a text object the =$(=vPeriodDate) displays the value 40760&lt;/P&gt;&lt;P&gt;on another text object the =$(=vStartYear) displays the value 40575&lt;/P&gt;&lt;P&gt;these values are correct &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the expression returns wrong values on the bar chart&lt;/P&gt;&lt;P&gt;However if I write the expression as follows the values are correct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PeriodDate = {"&amp;lt;=40760 &amp;gt;= 40575"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount)/1500&lt;/P&gt;&lt;P&gt;I get the correct values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise!!!&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Aug 2011 09:59:28 GMT</pubDate>
    <dc:creator>ali_hijazi</dc:creator>
    <dc:date>2011-08-24T09:59:28Z</dc:date>
    <item>
      <title>problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296372#M109928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I got a bar chart with the following expressions: ﻿&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PeriodDate = {"&amp;lt;=$(=vPeriodDate) &amp;gt;=$(=vStartYear)&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount)/1500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on a text object the =$(=vPeriodDate) displays the value 40760&lt;/P&gt;&lt;P&gt;on another text object the =$(=vStartYear) displays the value 40575&lt;/P&gt;&lt;P&gt;these values are correct &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the expression returns wrong values on the bar chart&lt;/P&gt;&lt;P&gt;However if I write the expression as follows the values are correct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PeriodDate = {"&amp;lt;=40760 &amp;gt;= 40575"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount)/1500&lt;/P&gt;&lt;P&gt;I get the correct values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise!!!&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 09:59:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296372#M109928</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2011-08-24T09:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296373#M109929</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;Try instead&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;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt; PeriodDate = {"&amp;gt;=$(#vStartYear)&amp;lt;=$(#vPeriodDate)"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount)/1500&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The $(#variable) forces to return a numeric value, when possible. &lt;/P&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>Wed, 24 Aug 2011 10:15:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296373#M109929</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-08-24T10:15:06Z</dc:date>
    </item>
    <item>
      <title>problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296374#M109930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Oh no this gave me far different numbers &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 12:32:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296374#M109930</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2011-08-24T12:32:21Z</dc:date>
    </item>
    <item>
      <title>problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296375#M109931</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; Please tell us what does variable contains. and how you are getting it.&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>Wed, 24 Aug 2011 12:34:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296375#M109931</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-08-24T12:34:47Z</dc:date>
    </item>
    <item>
      <title>problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296376#M109932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; vStartYear is defined as follows:&lt;/P&gt;&lt;P&gt;= Num(YearStart(PeriodDate,0,2))&lt;/P&gt;&lt;P&gt;and vPeriodDate is defined as follows:&lt;/P&gt;&lt;P&gt;if(PeriodDate = Today(), date(PeriodDate -1),PeriodDate) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 12:42:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296376#M109932</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2011-08-24T12:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: problem with QlikView variables!!!</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296377#M109933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vStartYear is actually a number while vPeriodDate is not, or at least, not always, since Date() function returns a string. Both must be in the same format PeriodDate is (I assume is a number since it's being compared to Today()). There are a lot of posts in this regard in the forums, but I'd recommend to properly format them in the script (so all they have the same format, numeric preferable).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a text object and test your expressions there, but for the time being this should do instead of your current vPeriodDate&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(PeriodDate = Today(), Num(Date(PeriodDate -1)), PeriodDate)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now both variables and PeriodDate field will return a number (in the QlikView date format, kind of "40779") that can be used in the set analysis and should work as expected using the expression in my previous post.&lt;/P&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 active_link" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0; text-decoration: underline;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 16:02:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-QlikView-variables/m-p/296377#M109933</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-08-24T16:02:06Z</dc:date>
    </item>
  </channel>
</rss>

