<?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: Set expression with -= giving unexpected result in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622627#M733603</link>
    <description>&lt;P&gt;It does, I would try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUM(
  {$&amp;lt;
    DateWeek = {$(varLastWeek)},
    DateFY={$(varLastYear)},
    SubGroup = {"&amp;gt;=11&amp;lt;=85"},
    Branch = {"&amp;lt;1032"}-{40}
  &amp;gt;}  SalesValueGross
)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 11 Sep 2019 12:52:48 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-09-11T12:52:48Z</dc:date>
    <item>
      <title>Set expression with -= giving unexpected result</title>
      <link>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622612#M733600</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to convert an expression like this:&lt;/P&gt;&lt;P&gt;SUM(&lt;BR /&gt;&amp;nbsp; IF(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DateWeek = $(varLastWeek) AND&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DateFY = $(varLastYear) AND&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; SubGroup &amp;gt;= 11 AND&lt;BR /&gt;&amp;nbsp; &amp;nbsp; SubGroup &amp;lt;= 85 AND&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Branch &amp;lt; 1032 AND&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Branch &amp;lt;&amp;gt; 40,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; SalesValueGross&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;into a set expression, something like this:&lt;/P&gt;&lt;P&gt;SUM(&lt;BR /&gt;&amp;nbsp; {$&amp;lt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DateWeek = {$(varLastWeek)},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DateFY={$(varLastYear)},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; SubGroup = {"&amp;gt;=11&amp;lt;=85"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Branch = {"&amp;lt;1032"},&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Branch -= {40}&lt;BR /&gt;&amp;nbsp; &amp;gt;}&amp;nbsp; SalesValueGross&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;Everything works fine until the last line: Branch -= {40}&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I create the expressions line by line, the two versions of the expression give me what I expect at the same stage, until I add the "-=" at the end. I have tried changing where the "-=" line sits relative to the other lines, which sometimes changes the result but is still not the correct one.&lt;/P&gt;&lt;P&gt;Obviously I am doing something wrong here, but I can't figure out what. I would be grateful for some guidance.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622612#M733600</guid>
      <dc:creator>bobpants</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression with -= giving unexpected result</title>
      <link>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622615#M733601</link>
      <description>&lt;P&gt;Try this may be... assuming&amp;nbsp; &amp;lt;&amp;gt; 40 is for SubGroup and not Branch.... and Branch condition seems to be not available in the if expression....&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUM(
  {$&amp;lt;
    DateWeek = {$(varLastWeek)},
    DateFY={$(varLastYear)},
    SubGroup = {"&amp;gt;=11&amp;lt;=85"}-{40},
    Branch = {"&amp;lt;1032"}
  &amp;gt;}  SalesValueGross
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:34:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622615#M733601</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-09-11T12:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression with -= giving unexpected result</title>
      <link>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622623#M733602</link>
      <description>&lt;P&gt;Sunny,&lt;/P&gt;&lt;P&gt;Thanks for the quick reply, but I had simplified the original expression to make it more readable here and messed it up. I have edited the post now, in case you feel like having another look.&lt;/P&gt;&lt;P&gt;I think your first suggestion probably still applies:&amp;nbsp; Branch =&amp;nbsp;{"&amp;lt;1032"} - {1}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:49:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622623#M733602</guid>
      <dc:creator>bobpants</dc:creator>
      <dc:date>2019-09-11T12:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression with -= giving unexpected result</title>
      <link>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622627#M733603</link>
      <description>&lt;P&gt;It does, I would try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUM(
  {$&amp;lt;
    DateWeek = {$(varLastWeek)},
    DateFY={$(varLastYear)},
    SubGroup = {"&amp;gt;=11&amp;lt;=85"},
    Branch = {"&amp;lt;1032"}-{40}
  &amp;gt;}  SalesValueGross
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:52:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-expression-with-giving-unexpected-result/m-p/1622627#M733603</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-09-11T12:52:48Z</dc:date>
    </item>
  </channel>
</rss>

