<?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 Counting Non-Null Values Across Multiple Fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428278#M159619</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to count the number of fields with a value across multiple fields.&amp;nbsp; If I was using excel, I would use the either of the following formulas:&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IF(Field1=0,0,1)+IF(Field2=0,0,1)+IF(Field3=0,0,1) ﻿&lt;/LI&gt;&lt;LI&gt;IF(Field1="",0,1﻿)+IF(Field2="",0,1)+IF(Field3="",0,1)﻿&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using either of these formulas, the null values were not counted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not work in Qlikview.&amp;nbsp; When I enter either of the above &lt;/P&gt;&lt;P&gt;&lt;/P&gt;formulas in the script, it will always count the null values.&amp;nbsp; I have tried the two formulas above along with the following:&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;LI&gt;IF(Field1='',0,1)+IF(Field2='',0,1)+IF(Field3='',0,1) as OutOf﻿﻿&lt;/LI&gt;&lt;LI&gt;IF(Field1=null(),0,1)+IF(Field2=null(),0,1)+IF(Field3=null(),0,1) as OutOf&lt;/LI&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to not count null values in the formula?&amp;nbsp; How do I approach this in Qlikview to get the results I would from excel?&amp;nbsp; Any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Mar 2013 14:23:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-03-11T14:23:53Z</dc:date>
    <item>
      <title>Counting Non-Null Values Across Multiple Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428278#M159619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to count the number of fields with a value across multiple fields.&amp;nbsp; If I was using excel, I would use the either of the following formulas:&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IF(Field1=0,0,1)+IF(Field2=0,0,1)+IF(Field3=0,0,1) ﻿&lt;/LI&gt;&lt;LI&gt;IF(Field1="",0,1﻿)+IF(Field2="",0,1)+IF(Field3="",0,1)﻿&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using either of these formulas, the null values were not counted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not work in Qlikview.&amp;nbsp; When I enter either of the above &lt;/P&gt;&lt;P&gt;&lt;/P&gt;formulas in the script, it will always count the null values.&amp;nbsp; I have tried the two formulas above along with the following:&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;LI&gt;IF(Field1='',0,1)+IF(Field2='',0,1)+IF(Field3='',0,1) as OutOf﻿﻿&lt;/LI&gt;&lt;LI&gt;IF(Field1=null(),0,1)+IF(Field2=null(),0,1)+IF(Field3=null(),0,1) as OutOf&lt;/LI&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to not count null values in the formula?&amp;nbsp; How do I approach this in Qlikview to get the results I would from excel?&amp;nbsp; Any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 14:23:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428278#M159619</guid>
      <dc:creator />
      <dc:date>2013-03-11T14:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Non-Null Values Across Multiple Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428279#M159620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To determine if a field is null or an empty string you can do it with &lt;EM&gt;if(len(trim(MyField))=0,1,0) as IsNull&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In the script you can calculate aggregated counts with something like &lt;EM&gt;count(MyField)-nullcount(MyField) as MyCount. &lt;/EM&gt;(don't forget the group by clause)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In expressions you can use count({&amp;lt;MyField={'*'}&amp;gt;}MyField)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 14:30:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428279#M159620</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-03-11T14:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Non-Null Values Across Multiple Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428280#M159621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the script formula: count(Field1)-nullcount(Field1) as MyCount and received an Invalid Expression on the load.&amp;nbsp; I am guessing this is because I am missing the GROUP BY clause.&amp;nbsp; I am not very familiar with how this clause works.&amp;nbsp; Can you provide an example?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I have attached a copy of the Qlikview Script and the output I would typically get with Excel, as an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for you help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 15:57:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428280#M159621</guid>
      <dc:creator />
      <dc:date>2013-03-11T15:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Non-Null Values Across Multiple Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428281#M159622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, like that. Try: -rangesum(isnum(Field1),isnum(Field2),isnum(Field3)) as Count&lt;/P&gt;&lt;P&gt;If the contents of Fieldx is a number then isnum returns -1, otherwise 0. We add those and multiply with -1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 17:25:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428281#M159622</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-03-11T17:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Non-Null Values Across Multiple Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428282#M159623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:15:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-Non-Null-Values-Across-Multiple-Fields/m-p/428282#M159623</guid>
      <dc:creator />
      <dc:date>2013-03-11T18:15:01Z</dc:date>
    </item>
  </channel>
</rss>

