<?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 Set analysis expression into variable, issue with date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-analysis-expression-into-variable-issue-with-date/m-p/1026531#M941539</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having an issue when trying to put an expression into a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a text object with the following expression, giving the right number (production of last year before the current month) :&lt;/P&gt;&lt;P&gt;=Num(Sum({1&amp;lt;Year = {$(=v_YearReference-1)}, Month = {"&amp;lt;=$(v_MonthReference)"}, [_REF_DESC] = {"Actual"}, FACT_TYPE_ID={"PKG02"} &amp;gt;} [FACT_VALUE]), '# ##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to put this expression into a variable in order to have all expressions visible in the script and make maintenance easier. So I did the following in the script : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET v_ProducedYTDPreviousYear = Num(Sum({1&amp;lt;Year = {$(=v_YearReference-1)}, Month = {"&amp;lt;=$(v_MonthReference)"}, [_REF_DESC] = {"Actual"}, FACT_TYPE_ID={"PKG02"} &amp;gt;} [FACT_VALUE]), '# ##0');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...and I put this in the text object :&lt;/P&gt;&lt;P&gt;=$(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;v_ProducedYTDPreviousYear&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is that I now have 0 displayed in the text object, and I don't know why. Maybe it has something to do with SET/LET or the way I calculate the year and month, but I'm quite new to Qlikview and don't understand everything. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : &lt;SPAN style="font-size: 13.3333330154419px;"&gt;There if I put &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;v_ProducedYTDPreviousYear, it shows the expression with Year={}.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Note2: &lt;/SPAN&gt;The same expression works if I use &lt;SPAN style="font-size: 13.3333330154419px;"&gt;$(v_YearReference) instead of &lt;/SPAN&gt;$(=v_YearReference-1). What is the difference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2016 14:12:46 GMT</pubDate>
    <dc:creator>emmanueld</dc:creator>
    <dc:date>2016-01-19T14:12:46Z</dc:date>
    <item>
      <title>Set analysis expression into variable, issue with date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-expression-into-variable-issue-with-date/m-p/1026531#M941539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having an issue when trying to put an expression into a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a text object with the following expression, giving the right number (production of last year before the current month) :&lt;/P&gt;&lt;P&gt;=Num(Sum({1&amp;lt;Year = {$(=v_YearReference-1)}, Month = {"&amp;lt;=$(v_MonthReference)"}, [_REF_DESC] = {"Actual"}, FACT_TYPE_ID={"PKG02"} &amp;gt;} [FACT_VALUE]), '# ##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to put this expression into a variable in order to have all expressions visible in the script and make maintenance easier. So I did the following in the script : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET v_ProducedYTDPreviousYear = Num(Sum({1&amp;lt;Year = {$(=v_YearReference-1)}, Month = {"&amp;lt;=$(v_MonthReference)"}, [_REF_DESC] = {"Actual"}, FACT_TYPE_ID={"PKG02"} &amp;gt;} [FACT_VALUE]), '# ##0');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...and I put this in the text object :&lt;/P&gt;&lt;P&gt;=$(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;v_ProducedYTDPreviousYear&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is that I now have 0 displayed in the text object, and I don't know why. Maybe it has something to do with SET/LET or the way I calculate the year and month, but I'm quite new to Qlikview and don't understand everything. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : &lt;SPAN style="font-size: 13.3333330154419px;"&gt;There if I put &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;v_ProducedYTDPreviousYear, it shows the expression with Year={}.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Note2: &lt;/SPAN&gt;The same expression works if I use &lt;SPAN style="font-size: 13.3333330154419px;"&gt;$(v_YearReference) instead of &lt;/SPAN&gt;$(=v_YearReference-1). What is the difference?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 14:12:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-expression-into-variable-issue-with-date/m-p/1026531#M941539</guid>
      <dc:creator>emmanueld</dc:creator>
      <dc:date>2016-01-19T14:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis expression into variable, issue with date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-expression-into-variable-issue-with-date/m-p/1026532#M941540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found out what my issue was. I shouldn't have put my expressions in the script, but directly in the variable overview.&lt;BR /&gt;The difference : &lt;/P&gt;&lt;P&gt;- with the expressions in the script, the &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;{$(=xxx)} inside the expression are calculated when executing the script. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;- with the expressions in the &lt;SPAN style="font-size: 13.3333330154419px;"&gt;variable overview, the whole expression is calculated at runtime, so &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;{$(=xxx)} is too.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2016 10:57:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-expression-into-variable-issue-with-date/m-p/1026532#M941540</guid>
      <dc:creator>emmanueld</dc:creator>
      <dc:date>2016-01-27T10:57:06Z</dc:date>
    </item>
  </channel>
</rss>

