<?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 Count query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296979#M1200112</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;BR /&gt;I hope someone can help.&lt;/P&gt;&lt;P&gt;I have a seemingly basic query where I wish to count the number of records from our ODBC database where field name &lt;STRONG&gt;pova&lt;/STRONG&gt; = 0 , where fields &lt;STRONG&gt;crbrenh&lt;/STRONG&gt;,&lt;STRONG&gt;crbrbasic&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;crbrenh&lt;/STRONG&gt; are NULL and where &lt;STRONG&gt;employstatus&lt;/STRONG&gt; &amp;lt;&amp;gt; 999001302&lt;/P&gt;&lt;P&gt;I have tried various different coding but it does not return what I know to be correct. I have put the fields into a table to see what I am looking at and the fields &lt;STRONG&gt;crbrenh&lt;/STRONG&gt;,&lt;STRONG&gt;crbrbasic&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;crbrenh&lt;/STRONG&gt; appear to be a mixture of blanks and - so I suspect this is part or all of the problem.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Dec 2010 15:08:17 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-12-29T15:08:17Z</dc:date>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296979#M1200112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;BR /&gt;I hope someone can help.&lt;/P&gt;&lt;P&gt;I have a seemingly basic query where I wish to count the number of records from our ODBC database where field name &lt;STRONG&gt;pova&lt;/STRONG&gt; = 0 , where fields &lt;STRONG&gt;crbrenh&lt;/STRONG&gt;,&lt;STRONG&gt;crbrbasic&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;crbrenh&lt;/STRONG&gt; are NULL and where &lt;STRONG&gt;employstatus&lt;/STRONG&gt; &amp;lt;&amp;gt; 999001302&lt;/P&gt;&lt;P&gt;I have tried various different coding but it does not return what I know to be correct. I have put the fields into a table to see what I am looking at and the fields &lt;STRONG&gt;crbrenh&lt;/STRONG&gt;,&lt;STRONG&gt;crbrbasic&lt;/STRONG&gt; &amp;amp; &lt;STRONG&gt;crbrenh&lt;/STRONG&gt; appear to be a mixture of blanks and - so I suspect this is part or all of the problem.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 15:08:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296979#M1200112</guid>
      <dc:creator />
      <dc:date>2010-12-29T15:08:17Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296980#M1200113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sum({$&amp;lt;pova={0},crbrenh=,crbrbasic=,employstatus-={999001302}&amp;gt;} 1)&lt;/P&gt;&lt;P&gt;I didn't tested it but should be something like that.&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 15:25:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296980#M1200113</guid>
      <dc:creator />
      <dc:date>2010-12-29T15:25:32Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296981#M1200114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply Sebastian however this is not working and I have tried different variations on this as well.&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;pova={0},crbrenh=,crbrbasic=,employstatus-={999001302}&amp;gt;} 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I wish to exclude the value &lt;STRONG&gt;999001302,&lt;/STRONG&gt; I presume you mean the following instead?&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;pova={0},crbrenh=,crbrbasic=,employstatus&lt;STRONG&gt;&amp;lt;&amp;gt;{&lt;/STRONG&gt;999001302}&amp;gt;} 1)&lt;/P&gt;&lt;P&gt;Also is there any significance in the &lt;STRONG&gt;crbrenh=,crbrbasic=,&lt;/STRONG&gt; code as I have previously thought it should be &lt;STRONG&gt;crbrenh=0&lt;/STRONG&gt; or &lt;STRONG&gt;isnull(crbenh)&lt;/STRONG&gt; if I want to count blank values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 15:59:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296981#M1200114</guid>
      <dc:creator />
      <dc:date>2010-12-29T15:59:02Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296982#M1200115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure about the fact to do a sum of 1...&lt;/P&gt;&lt;P&gt;The Set analysis explanation is:&lt;/P&gt;&lt;P&gt;"crbenh=" : That means take all values for this field. So it will exclude the null values&lt;/P&gt;&lt;P&gt;"employstatus -={999001302}" there is a "-" before the "=": That means take everything except 999001302.&lt;/P&gt;&lt;P&gt;You should try to replace the Sum( by count if you ha ve an ID field to count on :&lt;/P&gt;&lt;P&gt;count(distinct {$&amp;lt;pova={0} .....&amp;gt;} IFFIELD) ...&lt;/P&gt;&lt;P&gt;If still not working, test the count by adding each condition one by one...&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 16:04:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296982#M1200115</guid>
      <dc:creator />
      <dc:date>2010-12-29T16:04:44Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296983#M1200116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Better add some fields at the script level&lt;/P&gt;&lt;P&gt;if(len(trim(crbrenh))=0,1,0) as crbrenhFlag,&lt;/P&gt;&lt;P&gt;if(len(trim(crbrbasic))=0,1,0) as crbrbasicFlag,&lt;/P&gt;&lt;P&gt;And change your expression to---&lt;/P&gt;&lt;P&gt;Count({$&amp;lt;pova={0},crbrenhFlag={0},crbrbasicFlag={0},employstatus={'&amp;lt;&amp;gt;999001302'}&amp;gt;} the field you want to count)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 16:09:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296983#M1200116</guid>
      <dc:creator>syed_muzammil</dc:creator>
      <dc:date>2010-12-29T16:09:18Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296984#M1200117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Syed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried pasting your if commands in the Edit Script function after the rest of the existing commands as follows:&lt;/P&gt;&lt;P&gt;SQL SELECT empid as personno, crbrbasic, crbrstand, crbrenh, pova, payrollno&lt;BR /&gt;FROM XXX.dbo.employee where current_ = 1 and payrollno &amp;lt;&amp;gt; ' ';&lt;/P&gt;&lt;P&gt;if(len(trim(crbrenh))=0,1,0) as crbrenhFlag;&lt;BR /&gt;if(len(trim(crbrstand))=0,1,0) as crbrstandFlag;&lt;BR /&gt;if(len(trim(crbrbasic))=0,1,0) as crbrbasicFlag;&lt;/P&gt;&lt;P&gt;but get the following message (which I have only got since I pasted your coding)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error in expression:&lt;BR /&gt;')' expected&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I cannot see where a ')' should fit in this? Should this be elsewhere in the Edit Script command?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 16:46:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296984#M1200117</guid>
      <dc:creator />
      <dc:date>2010-12-29T16:46:29Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296985#M1200118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your script should be like that:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if(isnull(crbrenh),1,0) as crbrenhFlag,&lt;/P&gt;&lt;P&gt;if(isnull(crbrstand),1,0) as crbrstandFlag,&lt;/P&gt;&lt;P&gt;if(isnull(crbrbasic),1,0) as crbrbasicFlag;&lt;/P&gt;&lt;P&gt;SQL SELECT empid as personno, crbrbasic, crbrstand, crbrenh, pova, payrollno&lt;BR /&gt;FROM XXX.dbo.employee where current_ = 1 and payrollno &amp;lt;&amp;gt; ' ';&lt;/P&gt;&lt;P&gt;if(len(trim(crbrenh))=0,1,0) as crbrenhFlag;&lt;BR /&gt;if(len(trim(crbrstand))=0,1,0) as crbrstandFlag;&lt;BR /&gt;if(len(trim(crbrbasic))=0,1,0) as crbrbasicFlag;&lt;/P&gt;&lt;P&gt;Then try the expression as advised...&lt;/P&gt;&lt;P&gt;But the -= works fine, there is no need to do {'&amp;lt;&amp;gt;999xxxxx'}...&lt;/P&gt;&lt;P&gt;But if you prefer like that...&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 17:09:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296985#M1200118</guid>
      <dc:creator />
      <dc:date>2010-12-29T17:09:35Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296986#M1200119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Spastor but I have tried your suggestion and it is still coming back with the same error &lt;STRONG&gt;Error in expression:&lt;BR /&gt;')' expected&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;(if(isnull(crbrenh),1,0) as crbrenhFlag),&lt;/P&gt;&lt;P&gt;(if(isnull(crbrstand),1,0) as crbrstandFlag),&lt;/P&gt;&lt;P&gt;(if(isnull(crbrbasic),1,0) as crbrbasicFlag);&lt;/P&gt;&lt;P&gt;SQL SELECT empid as personno, crbrbasic, crbrstand, crbrenh, pova, payrollno&lt;BR /&gt;FROM xxx.dbo.employee where current_ = 1 and payrollno &amp;lt;&amp;gt; ' ';&lt;/P&gt;&lt;P&gt;if(len(trim(crbrenh))=0,1,0) as crbrenhFlag;&lt;BR /&gt;if(len(trim(crbrstand))=0,1,0) as crbrstandFlag;&lt;BR /&gt;if(len(trim(crbrbasic))=0,1,0) as crbrbasicFlag;&lt;/P&gt;&lt;P&gt;I have to say, as a complete beginner, Qlikview can be extremely frustrating (especially when you do not save before Edit Script and if it doesnt work &amp;amp; comes back with an error, you lose all of your changes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 16:45:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296986#M1200119</guid>
      <dc:creator />
      <dc:date>2010-12-30T16:45:04Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296987#M1200120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the goog pne is :&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;if(isnull(crbrenh),1,0) as crbrenhFlag,&lt;/P&gt;&lt;P&gt;if(isnull(crbrstand),1,0) as crbrstandFlag,&lt;/P&gt;&lt;P&gt;if(isnull(crbrbasic),1,0) as crbrbasicFlag;&lt;/P&gt;&lt;P&gt;SQL SELECT empid as personno, crbrbasic, crbrstand, crbrenh, pova, payrollno&lt;BR /&gt;FROM xxx.dbo.employee where current_ = 1 and payrollno &amp;lt;&amp;gt; ' ';&lt;/P&gt;&lt;P&gt;Don't forget to save before reloading &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 16:53:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296987#M1200120</guid>
      <dc:creator />
      <dc:date>2010-12-30T16:53:09Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296988#M1200121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Matt,&lt;/P&gt;&lt;P&gt;The script, as suggested by Syed adn Sébastien, should look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Table:LOAD *, // loads all previously fields pulled from the database in the SQL SELECT query If(Len(crbrenh), 0, 1) as crbrenhNullFlag, // If length of field is zero (null or empty or missing) from the database, then store a "1" in this field, otherwise "0" If(Len(crbrstand), 0, 1) as crbrstandNullFlag, If(Len(crbrbasic), 0, 1) as crbrbasicNullFlag; // Missing employstatus below!SQL SELECT empid as personno, crbrbasic, crbrstand, crbrenh, pova, payrollnoFROM xxx.dbo.employee where current_ = 1 and payrollno &amp;lt;&amp;gt; ' ';&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I always use Len(field) instead of IsNull() because some strange behaviour in different 32bits and 64 bits architectures. Len(Field) will always be equal to zero when there is no value stored in that field in the record.&lt;/P&gt;&lt;P&gt;Now create a new text object and type the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Count({&amp;lt; pova = {0}, crbrenhNullFlag = {1}, crbrstandNullFlag = {1}, crbrbasicNullFlag = {1}, employstatus -= {999001302} &amp;gt;} personno)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Note that in QlikView field names and values are case sensitive. Note that field "employstatus" used in the expression above is not being loaded by your script nor retrieved from the database in your SQL statement, so you should add it.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 16:59:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296988#M1200121</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-12-30T16:59:34Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296989#M1200122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;cayfmatt wrote:I have to say, as a complete beginner, Qlikview can be extremely frustrating (especially when you do not save before Edit Script and if it doesnt work &amp;amp; comes back with an error, you lose all of your changes!&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Agree. Fortunately, there are some good settings to check in QlikView. Go to the Settings menu, User Preferences, and tab "Save". Click on "Save before reload" and set the others as you wish. All these settings are documented in the Reference Manual available in the Dowloads section above as well as when you install QlikView choosing "Complete Install".&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 17:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296989#M1200122</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-12-30T17:05:27Z</dc:date>
    </item>
    <item>
      <title>Count query</title>
      <link>https://community.qlik.com/t5/QlikView/Count-query/m-p/296990#M1200123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sebastian and Miguel.&lt;/P&gt;&lt;P&gt;Miguel - I have been getting the employstatus from another section of coding within Edit Script but didnt want to paste it all in. I'm now down to about 22 'wrong' records from over 200 before so thanks again, I'll continue playing around with it (also now enabled the auto save function &lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Dec 2010 13:37:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-query/m-p/296990#M1200123</guid>
      <dc:creator />
      <dc:date>2010-12-31T13:37:04Z</dc:date>
    </item>
  </channel>
</rss>

