<?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: Variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115911#M911135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, this was incredibly helpful and I believe that I have discovered the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how the original application looked:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="A.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126778_A.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Here is what I wanted to change it to (which now functions):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="B.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/126791_B.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;My mistake was rather than replacing the expression I commented out the original expression and added mine below it:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="B2.jpg" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/126792_B2.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Which resulted in the following failed expression:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="C.jpg" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/126793_C.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jun 2016 12:26:17 GMT</pubDate>
    <dc:creator>hobanwashburne</dc:creator>
    <dc:date>2016-06-03T12:26:17Z</dc:date>
    <item>
      <title>Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115906#M911130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why does&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x = sum( {&amp;lt; FiscalYear = {2013} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;y = sum( {&amp;lt; FiscalYear = {2012} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sometimes not work, but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; x = sum( if(FiscalYear = 2013, (NetSales * SalespersonPercentage/100)),0))&lt;/P&gt;&lt;P&gt; y = sum( if(FiscalYear = 2012, (NetSales * SalespersonPercentage/100)),0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does as a Variable Definition when used in a Chart Expression as $(x)/$(y)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either one work and are equal when used alone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115906#M911130</guid>
      <dc:creator>hobanwashburne</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115907#M911131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you have selected FiscalYear 2014, your expression will not work. You use $(x) to evaluate the variable on object.&lt;/P&gt;&lt;P&gt;I think that is better:&lt;/P&gt;&lt;P&gt;x = sum( {&amp;lt; FiscalYear = {'=$(=Max(FiscalYear))'} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;y = sum( {&amp;lt; FiscalYear = {'=$(=Max(FiscalYear)-1)'} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you add values on Set modifier, is better use simple commas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x = sum( {&amp;lt; FiscalYear = {'2013'} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;y = sum( {&amp;lt; FiscalYear = {'2012'} &amp;gt;} (NetSales * SalespersonPercentage/100))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2016 15:40:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115907#M911131</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-02T15:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115908#M911132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the response, however it is not working in my problem application. I have created a Test application with three identical charts. In the fist I calculate everything in the object, Chart A uses variables and set analysis, Chart B uses variables and an "if statement".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything seems to work in the Test application attached, however in the application that I am editing Chart A fails on the % column, it only displays "-".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also you may notice the field FiscalYear has been changed to YEAR to match the problem application. I thought that because year was also a command it may have been the issue. However, as you can see on the attachment it seems to function in the Test.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2016 18:08:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115908#M911132</guid>
      <dc:creator>hobanwashburne</dc:creator>
      <dc:date>2016-06-02T18:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115909#M911133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the issue might be related to the fact that the Year is coming from another table compared to SalesPersonPercentage. I am not 100% sure what the issue is, but set analysis seems to not work under some cases when the data is coming from different tables. I am not 100% sure, but may be &lt;A href="https://community.qlik.com/qlik-users/15823"&gt;swuehl&lt;/A&gt; can enlighten us&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2016 18:14:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115909#M911133</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-06-02T18:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115910#M911134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you remove the label from your percentage expression and then hover with the mouse of the expression column header, what do you see with the variables expanded? Could you make a screen shot and upload?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-06-03 00_52_41-QlikView x64 - [C__Users_Stefan_Downloads_Test 02.qvw_].png" class="jive-image image-1" src="/legacyfs/online/126746_2016-06-03 00_52_41-QlikView x64 - [C__Users_Stefan_Downloads_Test 02.qvw_].png" style="height: 102px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides this, does your problem application show the exact same data model or is it different? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jun 2016 22:55:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115910#M911134</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-06-02T22:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115911#M911135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, this was incredibly helpful and I believe that I have discovered the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how the original application looked:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="A.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126778_A.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Here is what I wanted to change it to (which now functions):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="B.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/126791_B.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;My mistake was rather than replacing the expression I commented out the original expression and added mine below it:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="B2.jpg" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/126792_B2.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Which resulted in the following failed expression:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="C.jpg" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/126793_C.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 12:26:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115911#M911135</guid>
      <dc:creator>hobanwashburne</dc:creator>
      <dc:date>2016-06-03T12:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115912#M911136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad that you've got it sorted out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's what I've assumed, that your variables expand to something that is not a proper expression.&lt;/P&gt;&lt;P&gt;Comments in variables are likely to mess up expressions that are made of a combination of variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I usually only enter a label in the expression header after my expressions are working correctly.&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>Fri, 03 Jun 2016 12:32:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115912#M911136</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-06-03T12:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Variables/m-p/1115913#M911137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;I usually only enter a label in the expression header after my expressions are working correctly.&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Nice advice. I will keep that in mind as well. Thanks for helping Stefan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jun 2016 12:35:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables/m-p/1115913#M911137</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-06-03T12:35:16Z</dc:date>
    </item>
  </channel>
</rss>

