<?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 Variable in expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76437#M779715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i am trying to use a variable in an expression using IF statement as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;without the IF statement, if i pull the variable in a table i get the required values but when i use the IF statement i am not getting any values. This could be due the the way i am calling variables but i am not able to figure the correct way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much welcome !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;Stock field contains stock quantity&lt;/P&gt;&lt;P&gt;Qty field Contains inbound quantity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables:&lt;/P&gt;&lt;P&gt;1) Stock_Launch_1 (Structure: Add current Stock &amp;amp; inbound stock then reduce sales till launch week ; definition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;////////////////////////////////&lt;/P&gt;&lt;P&gt;sum( total &amp;lt;[Item Code], [Item 2735D Ssn],DeptName,GroupName&amp;gt; {&amp;lt;Store = {"=left(Store,3) like('SOH')"}&amp;gt;&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;&amp;lt;Store = {"=left(Store,3) like('CDC')"}&amp;gt;} Stock) + sum({&amp;lt;[Expected WHSE delivery Week] = &lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;{"&amp;lt;$(=($1))"}&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;}Qty)&lt;/P&gt;&lt;P&gt;-&amp;nbsp; rangemin(sum(aggr(sum([Last 13 Weeks sale qty]/13),[Item Code],[Item 2735D Ssn],DeptName,GroupName))*(&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;($1)&lt;/STRONG&gt;&lt;/SPAN&gt;- 200-$(Week No.)), sum(&amp;nbsp; {&amp;lt;Store = {"=left(Store,3) like('SOH')"}&amp;gt; + &amp;lt;Store = {"=left(Store,3) like('CDC')"}&amp;gt;} Stock))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;/////////////////////////////////////&lt;/P&gt;&lt;P&gt;2) Launch (Structure: Number ; definition: 442)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Week No. (Structure: Number; definition: 40)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;expression to calculate stock: $(Stock_Launch_1(&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;$(Launch)&lt;/STRONG&gt;&lt;/SPAN&gt;)) - &lt;SPAN style="color: #339966;"&gt;works well&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;expression using IF statement: sum(aggr(if($(Stock_Launch_1&lt;STRONG style="color: #0000ff;"&gt;($(Launch)&lt;/STRONG&gt;)) &amp;gt; 0,1,0),[Item Code]))- &lt;SPAN style="color: #ff0000;"&gt;DOESN'T work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. I realized that if I define the variable Stock_Launch_1 to use Launch as a parameter &amp;amp; NOT $(Launch) the if statement works - no idea why but i can not use it that way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76437#M779715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, i am trying to use a variable in an expression using IF statement as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;without the IF statement, if i pull the variable in a table i get the required values but when i use the IF statement i am not getting any values. This could be due the the way i am calling variables but i am not able to figure the correct way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much welcome !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;Stock field contains stock quantity&lt;/P&gt;&lt;P&gt;Qty field Contains inbound quantity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables:&lt;/P&gt;&lt;P&gt;1) Stock_Launch_1 (Structure: Add current Stock &amp;amp; inbound stock then reduce sales till launch week ; definition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;////////////////////////////////&lt;/P&gt;&lt;P&gt;sum( total &amp;lt;[Item Code], [Item 2735D Ssn],DeptName,GroupName&amp;gt; {&amp;lt;Store = {"=left(Store,3) like('SOH')"}&amp;gt;&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;&amp;lt;Store = {"=left(Store,3) like('CDC')"}&amp;gt;} Stock) + sum({&amp;lt;[Expected WHSE delivery Week] = &lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;{"&amp;lt;$(=($1))"}&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;}Qty)&lt;/P&gt;&lt;P&gt;-&amp;nbsp; rangemin(sum(aggr(sum([Last 13 Weeks sale qty]/13),[Item Code],[Item 2735D Ssn],DeptName,GroupName))*(&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;($1)&lt;/STRONG&gt;&lt;/SPAN&gt;- 200-$(Week No.)), sum(&amp;nbsp; {&amp;lt;Store = {"=left(Store,3) like('SOH')"}&amp;gt; + &amp;lt;Store = {"=left(Store,3) like('CDC')"}&amp;gt;} Stock))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;/////////////////////////////////////&lt;/P&gt;&lt;P&gt;2) Launch (Structure: Number ; definition: 442)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Week No. (Structure: Number; definition: 40)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;expression to calculate stock: $(Stock_Launch_1(&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;$(Launch)&lt;/STRONG&gt;&lt;/SPAN&gt;)) - &lt;SPAN style="color: #339966;"&gt;works well&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;expression using IF statement: sum(aggr(if($(Stock_Launch_1&lt;STRONG style="color: #0000ff;"&gt;($(Launch)&lt;/STRONG&gt;)) &amp;gt; 0,1,0),[Item Code]))- &lt;SPAN style="color: #ff0000;"&gt;DOESN'T work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. I realized that if I define the variable Stock_Launch_1 to use Launch as a parameter &amp;amp; NOT $(Launch) the if statement works - no idea why but i can not use it that way.&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-in-expression/m-p/76437#M779715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76438#M779716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you try if.. statement alone without sum(aggr(...)) initially&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 01:48:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76438#M779716</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-04-10T01:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76439#M779717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anil - I tried it and it doesn't work in either form:&lt;/P&gt;&lt;P&gt;Form 1 - variable that uses (Launch) as a parameter: sum((if($(Stock_Launch_1($(Launch))) &amp;gt; 0,1,0)))&lt;/P&gt;&lt;P&gt;Form 2 - variable that uses ($Launch) as parameter: sum((if($(Stock_Launch(Launch)) &amp;gt; 0,1,0)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. I am trying to get the output in a table with Item Code as a dimension as shown below. The IF statement is for the expression "Avail" which returns a 0 OR 1 based on the IF statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/199016_Capture.JPG" style="height: 292px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 05:11:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76439#M779717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-10T05:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76440#M779718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you find the solution? Or still expecting &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 15:44:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-expression/m-p/76440#M779718</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-04-17T15:44:16Z</dc:date>
    </item>
  </channel>
</rss>

