<?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: help me to use of variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176110#M911031</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;Colin's answer is precise but if you want the last two years for table having more than 1 distinct year , then use an additional 'if' statement for checking the count in the expression which Manuel has provided .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Jun 2016 10:17:30 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-06-13T10:17:30Z</dc:date>
    <item>
      <title>help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176103#M911024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;i have a requirement that,&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;in table i have a year field with 2011,2012,2013,2014&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;now using a variable i need grab the last two values&amp;nbsp; even if another value is added to it&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;i.e, if we add 2015&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;i need to get 2014 and 2015&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if we add another one 2016&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;i need to get 2015 and 2016&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;last two values i have to get.&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/help-me-to-use-of-variable/m-p/1176103#M911024</guid>
      <dc:creator>laxmanqlik</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176104#M911025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi laxman,&lt;/P&gt;&lt;P&gt;If you need two variables to do it or if you want to make ranges:&lt;/P&gt;&lt;P&gt;vMaxYear = Max(Year)&lt;/P&gt;&lt;P&gt;vMinYear = Max({&amp;lt;Year = {"&amp;lt;$(vMaxYear)"}&amp;gt;}Year)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want it on same var to make selections with actions:&lt;/P&gt;&lt;P&gt;vMaxYear = Max(Year)&lt;/P&gt;&lt;P&gt;vYears = '('&amp;amp;Max(Year)&amp;amp;'|'&amp;amp;Max({&amp;lt;Year = {"&amp;lt;$(vMaxYear)"}&amp;gt;}Year)&amp;amp;')'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 08:16:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176104#M911025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-13T08:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176105#M911026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let vMaxY1 = max(Year) ;&lt;/P&gt;&lt;P&gt;Let vMaxY2 = (vMaxY1 - 1) ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 08:23:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176105#M911026</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2016-06-13T08:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176106#M911027</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;Colin's answer should get them for you, But there are a few different ways you can do this. &lt;/P&gt;&lt;P&gt;If you could supply us some more information on what your are wanting to do with these years we could suggest the best approach. &lt;/P&gt;&lt;P&gt;i.e. Just display in a test box or feed into set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 08:39:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176106#M911027</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2016-06-13T08:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176107#M911028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Colin,&lt;/P&gt;&lt;P&gt;What happen if there isn't two consecutive years?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 09:27:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176107#M911028</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-13T09:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176108#M911029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i tried but it showing &lt;/P&gt;&lt;P&gt;in valid dimesion&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:05:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176108#M911029</guid>
      <dc:creator>laxmanqlik</dc:creator>
      <dc:date>2016-06-13T10:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176109#M911030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi mark&lt;/P&gt;&lt;P&gt;i want to display it in a textbox&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:06:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176109#M911030</guid>
      <dc:creator>laxmanqlik</dc:creator>
      <dc:date>2016-06-13T10:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176110#M911031</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;Colin's answer is precise but if you want the last two years for table having more than 1 distinct year , then use an additional 'if' statement for checking the count in the expression which Manuel has provided .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:17:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176110#M911031</guid>
      <dc:creator />
      <dc:date>2016-06-13T10:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176111#M911032</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;One way would be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=' Selected - ' &amp;amp; MAX(GetFieldSelections(Year)) &amp;amp; '-&amp;nbsp; Previous - ' &amp;amp; MAX(GetFieldSelections(Year )-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:39:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176111#M911032</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2016-06-13T10:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176112#M911033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you share an example app?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:43:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176112#M911033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-13T10:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176113#M911035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IN the script editor do the following resident load&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14658153340662471" jivemacro_uid="_14658153340662471"&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; YearField&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "2011,2012,2013,2014,2016"&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We will assume the above is the data set for this example, from the above do a resident load&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14658153654414914" jivemacro_uid="_14658153654414914"&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;YearField,&lt;/P&gt;
&lt;P&gt;SubField(YearField,',') as FixedYearField&lt;/P&gt;
&lt;P&gt;Resident Data;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will create individual records for each year, and link back to the original text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in the chart expression use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Latest&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1465815409232195" jivemacro_uid="_1465815409232195"&gt;
&lt;P&gt;Max(FixedYearField,1)&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;Second&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14658154224448087" jivemacro_uid="_14658154224448087"&gt;
&lt;P&gt;Max(FixedYearField,2)&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just put the above in the variables you need&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 10:57:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176113#M911035</guid>
      <dc:creator>pho3nix90</dc:creator>
      <dc:date>2016-06-13T10:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176114#M911037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reading replies I might have misunderstood your explanation of the year. If it is just a normal year field then the below will do the trick, just replace FixedYearField with your field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Latest&lt;/P&gt;&lt;DIV class="bar" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658162470149868 jive_text_macro" jivemacro_uid="_14658162470149868"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(FixedYearField,1)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Second&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658157423172495 jive_text_macro" jivemacro_uid="_14658157423172495"&gt;
&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(FixedYearField,2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Or use this. set a variable with the below code &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658159407992170 jive_text_macro" jivemacro_uid="_14658159407992170"&gt;
&lt;P&gt;='Max(FixedYearField,$1)'&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you can now use a single variable to call records like below, for this example the variable is called vtest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now to&amp;nbsp; call the latest year, do&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14658161207062362 jive_text_macro" jivemacro_uid="_14658161207062362"&gt;
&lt;P&gt;$(vtest(1))&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;Second latest&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14658161361413615" jivemacro_uid="_14658161361413615"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;$(vtest(2))&lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;IMG __jive_id="127646" alt="vtest.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/127646_vtest.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 11:09:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176114#M911037</guid>
      <dc:creator>pho3nix90</dc:creator>
      <dc:date>2016-06-13T11:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: help me to use of variable</title>
      <link>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176115#M911038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi laxman,&lt;/P&gt;&lt;P&gt;Try this,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 11:38:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/help-me-to-use-of-variable/m-p/1176115#M911038</guid>
      <dc:creator>susovan</dc:creator>
      <dc:date>2016-06-13T11:38:29Z</dc:date>
    </item>
  </channel>
</rss>

