<?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: variable doesn't work in formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308864#M839290</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply, I tried that aswell but for me it doesn't seem to work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 May 2017 13:40:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-05-09T13:40:19Z</dc:date>
    <item>
      <title>variable doesn't work in formula</title>
      <link>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308862#M839288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem using a variable in a formula. In my qvw I want to compare 2 years with each other. I added 2 tables each with all the years without a conncection to any other table in the data model. These are used only for set analysis. As you can see the tables are not linked. In the blue box we find the formula of =money(sum({&amp;lt;Year={'$(vYearSelection2)'}&amp;gt;}_Amount))&lt;/P&gt;&lt;P&gt;The variable vYearSelection2 contains the following formula: =if(GetSelectedCount(YearSelection2)&amp;gt;0,GetFieldSelections(YearSelection2),max(YearSelection2))&lt;/P&gt;&lt;P&gt;This is used to select a year. I also have this for another year so that we can compare those two. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screenshot_2.png" class="jive-image image-1" height="133" src="https://community.qlik.com/legacyfs/online/162600_Screenshot_2.png" style="height: 133px; width: 227.449px;" width="228" /&gt;&lt;/P&gt;&lt;P&gt;However if I compare the two years I only want the sales of months that have sales in both periods. So I first created a variable to check which year has the least amount of months with sales in it :&lt;/P&gt;&lt;P&gt;=if(count({&amp;lt;Year={'$(vYearSelection1)'},_Amount={'&amp;gt;0'}&amp;gt;}Month)&amp;gt;count({&amp;lt;Year={'$(vYearSelection2)'},_Amount={'&amp;gt;0'}&amp;gt;}Month),'$(vYearSelection2)','$(vYearSelection1)')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I used this variable in another variable to store all of the year's months&lt;/P&gt;&lt;P&gt;concat(distinct {&amp;lt;Year={'$(vWorstYear)'}&amp;gt;}chr(39) &amp;amp; Month &amp;amp; chr(39),',')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now I want to use this variable in a set analysis expression to only show the sale of months that are stored in this variable&lt;/P&gt;&lt;P&gt;So the real problem is : I got my months outputted in the format i need e.g : 'apr','feb','jan'&lt;/P&gt;&lt;P&gt;But I can't use them in the formula &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The year with the least amount of months with sales in it is reffered to as 'Worst' Month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx!&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/variable-doesn-t-work-in-formula/m-p/1308862#M839288</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: variable doesn't work in formula</title>
      <link>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308863#M839289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try putting '=' before your variable definition. &lt;STRONG&gt;=&lt;/STRONG&gt;Concat(...&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/162610_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 May 2017 12:57:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308863#M839289</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2017-05-09T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: variable doesn't work in formula</title>
      <link>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308864#M839290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply, I tried that aswell but for me it doesn't seem to work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 May 2017 13:40:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-doesn-t-work-in-formula/m-p/1308864#M839290</guid>
      <dc:creator />
      <dc:date>2017-05-09T13:40:19Z</dc:date>
    </item>
  </channel>
</rss>

