<?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: Setting Variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549661#M1145617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No idea. It works for me. See attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Aug 2013 17:38:00 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-08-01T17:38:00Z</dc:date>
    <item>
      <title>Setting Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549658#M1145614</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;I am trying to set variables to allow us to add expressions to straight tables to show the sum of current month, previous month etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My column name is CONTRACT_MONTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variables I have set are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vCurrMonth = =Max(CONTRACT_MONTH)&lt;/P&gt;&lt;P&gt;vLastMonth = =vCurrMonth-1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above return numeric results ie vCurrMonth = 8 and vLastMonth = 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My CONTRACT_MONTH data is in the format Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.&amp;nbsp; I am summing this data by a column called CONTRACT_QTY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be possible for someone to advise firstly how I set the variables to the above format and secondly how I can show those results in a straight table similar to the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desk&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SumCurrMonth&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SumLastMonth&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 15:05:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549658#M1145614</guid>
      <dc:creator>danielnevitt</dc:creator>
      <dc:date>2013-08-01T15:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549659#M1145615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a field with month numbers you could use that instead. Or create one in the script and then use it. Or you could add two helper variables to get the month names from the numbers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vCurrMonthName: =month(makedate(1,vCurrMonth))&lt;/P&gt;&lt;P&gt;vLastMonthName: =month(makedate(1,vLastMonth))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SumCurrMonth: =sum({&amp;lt;CONTRACT_MONTH={'$(vCurrMonthName)'}&amp;gt;}CONTRACT_QTY)&lt;/P&gt;&lt;P&gt;SumLastMonth: =sum({&amp;lt;CONTRACT_MONTH={'$(vLastMonthName)'}&amp;gt;}CONTRACT_QTY)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 16:44:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549659#M1145615</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-08-01T16:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549660#M1145616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The setting the MonthName works great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the SumCurrMonth and SumLastMonth do not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following expressions work (without variables):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;CONTRACT_MONTH={`Jun`}&amp;gt;}CONTRACT_QTY)&lt;/P&gt;&lt;P&gt;sum({&amp;lt;CONTRACT_MONTH={`Jul`}&amp;gt;}CONTRACT_QTY)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you able to suggest how to insert the variables to the above?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 17:01:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549660#M1145616</guid>
      <dc:creator>danielnevitt</dc:creator>
      <dc:date>2013-08-01T17:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549661#M1145617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No idea. It works for me. See attached example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 17:38:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Setting-Variables/m-p/549661#M1145617</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-08-01T17:38:00Z</dc:date>
    </item>
  </channel>
</rss>

