<?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: Nulls and Zeros in SUM function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038954#M349911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Qlik handles a SUM of NULL differently than some other DBMS / Tools.&lt;/P&gt;&lt;P&gt;See the reply from Henric here to understand the rationale behind:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/206310"&gt;Set analysis returns 0, for null records&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Qlik, there are functions to check for specific properties of a field when counting values, see NumericCount(FIELD), NULLCount(FIELD), MissingCount(FIELD), TextCount(FIELD), so maybe something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(NumericCount(FIELD), Sum(FIELD), NULL())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;can help you getting your requested result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Stefan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Mar 2016 17:26:01 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2016-03-09T17:26:01Z</dc:date>
    <item>
      <title>Nulls and Zeros in SUM function</title>
      <link>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038953#M349910</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 have a table which contains matters, claimants and reserves.&amp;nbsp; Each matter may have more than one claimant, and each claimant should have a reserve, but they aren't always completed for various reasons.&amp;nbsp; In my LOAD script, I want to produce a table of reserves at matter level, so summing up the reserves for all claimants on each matter. However I really need to be able to distinguish between matters where a zero has been completed for the reserve, and those where it has just not been completed at all (i.e. the reserve is NULL).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I usually do this in SQL but have recently started using Qlik and can't find the answer anywhere the forums.&amp;nbsp; In SQL I would use this syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;isnull(convert(varchar(50),cast(sum([Reserve]) as money),-1),'')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if no reserves have been completed on any given matter, it comes out as blank, whereas if one or more zeros have been completed, it comes out as zero.&amp;nbsp; In qlik even if all reserves on a matter are NULL, the SUM still seems to come out as zero rather than NULL.&amp;nbsp; I have tried first converting the NULLs into 'Missing' but these still seem to add up to zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this not possible in Qlik?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 11:06:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038953#M349910</guid>
      <dc:creator />
      <dc:date>2016-03-09T11:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nulls and Zeros in SUM function</title>
      <link>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038954#M349911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Qlik handles a SUM of NULL differently than some other DBMS / Tools.&lt;/P&gt;&lt;P&gt;See the reply from Henric here to understand the rationale behind:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/206310"&gt;Set analysis returns 0, for null records&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Qlik, there are functions to check for specific properties of a field when counting values, see NumericCount(FIELD), NULLCount(FIELD), MissingCount(FIELD), TextCount(FIELD), so maybe something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;If(NumericCount(FIELD), Sum(FIELD), NULL())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;can help you getting your requested result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Stefan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 17:26:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038954#M349911</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-03-09T17:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nulls and Zeros in SUM function</title>
      <link>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038955#M349912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If each claimant can have only one reserve then you can try only(reserve) as expression since there won't be a need to sum the reserve values. In a straight table you can set the Total Mode of the expression to Sum of Rows so you will get a total.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2016 18:56:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/1038955#M349912</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-09T18:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Nulls and Zeros in SUM function</title>
      <link>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/2141766#M1224855</link>
      <description>moved to new thread</description>
      <pubDate>Mon, 20 Nov 2023 14:17:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nulls-and-Zeros-in-SUM-function/m-p/2141766#M1224855</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2023-11-20T14:17:37Z</dc:date>
    </item>
  </channel>
</rss>

