<?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: Sum(A) + Sum(B) vs. Sum(A + B) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596731#M684394</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you instead of A+B write RangeSum(A,B), you will treat NULL as zeros. Hence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(RangeSum(A,B))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Feb 2014 17:40:49 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2014-02-17T17:40:49Z</dc:date>
    <item>
      <title>Sum(A) + Sum(B) vs. Sum(A + B)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596728#M684391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have a table consisting of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RowId - a unique identifier for each row&lt;/P&gt;&lt;P&gt;A - any real number&lt;/P&gt;&lt;P&gt;B - any real number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a couple of ways to sum A and B together:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Sum(A) + Sum(B) &lt;/LI&gt;&lt;LI&gt;Sum(A + B)&lt;/LI&gt;&lt;LI&gt;Sum(Aggr(A + B, RowId))&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(A + B) is equivalent to Sum(Aggr(A + B, RowId))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When A or B can be NULL, Sum(A + B) is not equivalent to Sum(A) + Sum(B). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why? Because any calculation involving NULL will yield NULL!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To take care of this, you can alter the field on load:&lt;/P&gt;&lt;P&gt;IF(IsNull(A), 0, A) AS A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would there be any situations in which you need a metric to be NULL? If so, is there a way to treat NULL as 0 in Sum(A + B)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 17:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596728#M684391</guid>
      <dc:creator />
      <dc:date>2014-02-17T17:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(A) + Sum(B) vs. Sum(A + B)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596729#M684392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the NullAsValue function to set how QlikView interprets nulls in the load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 17:21:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596729#M684392</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2014-02-17T17:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(A) + Sum(B) vs. Sum(A + B)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596730#M684393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=alt(null(), 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;help online&lt;/P&gt;&lt;P class="syntax"&gt;&lt;A name="kanchor407"&gt;&lt;/A&gt;&lt;A name="alt"&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN style="background-color: #0a246a; color: #ffffff;"&gt;alt&lt;/SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;case1[ , case2 , case3 , ...] , else&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;The &lt;SPAN style="color: #ffffff; background-color: #0a246a;"&gt;alt&lt;/SPAN&gt; function returns the first of the parameters that has a valid number representation. If no such match is found, the last parameter will be returned. Any number of parameters can be used. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 17:36:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596730#M684393</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-02-17T17:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(A) + Sum(B) vs. Sum(A + B)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596731#M684394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you instead of A+B write RangeSum(A,B), you will treat NULL as zeros. Hence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(RangeSum(A,B))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 17:40:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596731#M684394</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-02-17T17:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(A) + Sum(B) vs. Sum(A + B)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596732#M684395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dirk, If the fields are number (either real or intergers) you can use the &lt;STRONG&gt;ALT&lt;/STRONG&gt; function.&lt;/P&gt;&lt;P&gt;Alt(A,0) AS A&lt;/P&gt;&lt;P&gt;Alt(B,0) AS B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Feb 2014 18:05:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-A-Sum-B-vs-Sum-A-B/m-p/596732#M684395</guid>
      <dc:creator />
      <dc:date>2014-02-17T18:05:22Z</dc:date>
    </item>
  </channel>
</rss>

