<?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: counting with if-expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694533#M251141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added the attachment &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jul 2014 08:32:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-07-17T08:32:46Z</dc:date>
    <item>
      <title>counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694529#M251137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In attatchment a printscreen of the data I have.&lt;/P&gt;&lt;P&gt;The emptyings_error fiels contains text, nothing or a dash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count the emptyings_id where text is filled in and the emptyings_id where no text is filled in (dash and nothing in the field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The next two expressions I used to count the no-text fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count(distinct(if(match(emptyings_error,''), emptyings_id)))&lt;/P&gt;&lt;P&gt;-&amp;gt; to little results&lt;/P&gt;&lt;P&gt;count(distinct(if(match(emptyings_error,'NULL'), emptyings_id)))&lt;/P&gt;&lt;P&gt;-&amp;gt;no results, wrong expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression used to count the text-filled fields:&lt;/P&gt;&lt;P&gt;count(distinct(if(match(emptyings_error,'%'), emptyings_id)))&lt;/P&gt;&lt;P&gt;count(distinct(if(match(emptyings_error,'*'), emptyings_id)))&lt;/P&gt;&lt;P&gt;-&amp;gt;neither works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any help me write the correct expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Katleen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:11:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694529#M251137</guid>
      <dc:creator />
      <dc:date>2014-07-17T08:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694530#M251138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is the attachment? Kindly provide little sample data or sample qvw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:14:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694530#M251138</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-07-17T08:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694531#M251139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide some more info. Why are you using 'distinct'? If you're getting too little results, it may be due to this function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:21:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694531#M251139</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2014-07-17T08:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694532#M251140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_error field is null&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="[null,null,769,[null,0],null,null,null,null,null,null,null,1,0]" data-sheets-value="[null,2,&amp;quot;Count A when B is null\n=count({$&amp;lt;&amp;lt;A&amp;gt;={\&amp;quot;=isnull(B)\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)\n \nCount A when B is not null\n=count({$&amp;lt;&amp;lt;B&amp;gt;={\&amp;quot;*\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)&amp;quot;]" style="font-family: arial, sans, sans-serif;"&gt;=count({$&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_error&lt;/SPAN&gt;={"=isnull(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_error&lt;/SPAN&gt;)"}&amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;distinct&lt;/SPAN&gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_id&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="[null,null,769,[null,0],null,null,null,null,null,null,null,1,0]" data-sheets-value="[null,2,&amp;quot;Count A when B is null\n=count({$&amp;lt;&amp;lt;A&amp;gt;={\&amp;quot;=isnull(B)\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)\n \nCount A when B is not null\n=count({$&amp;lt;&amp;lt;B&amp;gt;={\&amp;quot;*\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)&amp;quot;]" style="font-family: arial, sans, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="[null,null,769,[null,0],null,null,null,null,null,null,null,1,0]" data-sheets-value="[null,2,&amp;quot;Count A when B is null\n=count({$&amp;lt;&amp;lt;A&amp;gt;={\&amp;quot;=isnull(B)\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)\n \nCount A when B is not null\n=count({$&amp;lt;&amp;lt;B&amp;gt;={\&amp;quot;*\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)&amp;quot;]" style="font-family: arial, sans, sans-serif;"&gt;When &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_error&lt;/SPAN&gt; field has value&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="[null,null,769,[null,0],null,null,null,null,null,null,null,1,0]" data-sheets-value="[null,2,&amp;quot;Count A when B is null\n=count({$&amp;lt;&amp;lt;A&amp;gt;={\&amp;quot;=isnull(B)\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)\n \nCount A when B is not null\n=count({$&amp;lt;&amp;lt;B&amp;gt;={\&amp;quot;*\&amp;quot;}&amp;gt;}&amp;lt;A&amp;gt;)&amp;quot;]" style="font-family: arial, sans, sans-serif;"&gt;&lt;SPAN style="font-family: arial, sans, sans-serif;"&gt;=count({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_error&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, sans, sans-serif;"&gt;={"*&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, sans, sans-serif;"&gt;"}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, sans, sans-serif;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;emptyings_id&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, sans, sans-serif;"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:30:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694532#M251140</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-17T08:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694533#M251141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added the attachment &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:32:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694533#M251141</guid>
      <dc:creator />
      <dc:date>2014-07-17T08:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694534#M251142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you have null as well as blank value in your dataset, in that case you can use Len() function to calculate ids. See below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, sans, sans-serif;"&gt;=Count(D&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;istinct&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, sans, sans-serif;"&gt; &lt;/SPAN&gt; If(Len(Trim(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;emptyings_error))=0,&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, sans, sans-serif;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;emptyings_id&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, sans, sans-serif;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:40:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694534#M251142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-07-17T08:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: counting with if-expression</title>
      <link>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694535#M251143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Hello Katleen,&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Why not work with an identifier first? You make an additional varaibale in the script, a numerical flag, which combines the dashes and the spaces into one.&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if&lt;SPAN style="color: #ff0000; font-size: 8pt;"&gt;&lt;STRONG style="color: #ff0000; font-size: 8pt;"&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;emptyings_error&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = '-',1,(if(emptyings_error = ' ',1,2))) as Flag_emptyings_error,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Once created, you can use a simple count&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; count(if(Flag_emptyings_error = 1), emptyings_id) for the dashes and spaces&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;count(if(Flag_emptyings_error = 2), emptyings_id) for the text&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 08:46:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/counting-with-if-expression/m-p/694535#M251143</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2014-07-17T08:46:53Z</dc:date>
    </item>
  </channel>
</rss>

