<?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: Set expressions to exclude nulls and count distinct elements not working. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073971#M88089</link>
    <description>&lt;P&gt;This one works.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not going back to check all the ones that I tried previously but my original formula also works again.&amp;nbsp; There must have been an anomaly somewhere that I was unaware of and couldn't find.&lt;/P&gt;
&lt;P&gt;Thanks for the help.&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 16:36:31 GMT</pubDate>
    <dc:creator>rmadursk</dc:creator>
    <dc:date>2023-05-22T16:36:31Z</dc:date>
    <item>
      <title>Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073444#M88033</link>
      <description>&lt;P&gt;I have a set of data that looks like this:&lt;/P&gt;
&lt;TABLE width="260"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;Attested_Date&lt;/TD&gt;
&lt;TD width="132"&gt;Service&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;3/31/2023&lt;/TD&gt;
&lt;TD width="132"&gt;satellite01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;3/31/2023&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvecc11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;3/31/2023&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvecc11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2023&lt;/TD&gt;
&lt;TD width="132"&gt;rtvspx01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2023&lt;/TD&gt;
&lt;TD width="132"&gt;rtvspx01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;6/30/2024&lt;/TD&gt;
&lt;TD width="132"&gt;triprh701&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;6/30/2025&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvecm04&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;6/30/2025&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvecm04&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2025&lt;/TD&gt;
&lt;TD width="132"&gt;spcsgridn02&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2025&lt;/TD&gt;
&lt;TD width="132"&gt;spcsgridn02&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2025&lt;/TD&gt;
&lt;TD width="132"&gt;spcsgsub01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2025&lt;/TD&gt;
&lt;TD width="132"&gt;spcsmtier01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;12/31/2025&lt;/TD&gt;
&lt;TD width="132"&gt;spcsmdata01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;-&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvemp21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;-&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvmdm01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;-&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvmdm01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;-&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvmgr01&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="128"&gt;-&lt;/TD&gt;
&lt;TD width="132"&gt;wbscvmgr90&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to know how many Distinct Service names have an Attested_Date.&lt;/P&gt;
&lt;P&gt;I've tried the following based on other Community posts:&lt;/P&gt;
&lt;P&gt;//Count({$&amp;lt;[Attested_Date] = {"=not isnull([ATTESTED_DATE] )"}&amp;gt;} DISTINCT([Service]))&lt;BR /&gt;//Count({$&amp;lt;[Attested_Date] -= "=Null()"&amp;gt;} DISTINCT([Service]))&lt;BR /&gt;//Count({$&amp;lt;[Attested_Date] = {'*'}&amp;gt;} DISTINCT([Service]))&lt;BR /&gt;//Count({$&amp;lt;[Attested_Date] = {"=Len(Trim([Attested_Date])) &amp;gt; 0"}&amp;gt;} DISTINCT([Service]))&lt;BR /&gt;//Count({$&amp;lt;[Attested_Date] = {'*'}-{''}&amp;gt;} DISTINCT([Service]))&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;These all just report back the count of distinct services (14) when it should be 9.&lt;/P&gt;
&lt;P&gt;This expression appeared to be working a couple of days ago but stopped for some reason.&amp;nbsp; I don't think it is the app since I created a new app with just this table and I get the same results.&amp;nbsp; The Null fields appear to be actual Null fields because they show up in Data Manager Preview Pane as Nulls.&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 19:51:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073444#M88033</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-19T19:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073449#M88034</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;Count({&amp;lt;Attested_Date={"=len(Attested_Date)&amp;gt;1"}&amp;gt;}Distinct Service)&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 21:01:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073449#M88034</guid>
      <dc:creator>Lisa_P</dc:creator>
      <dc:date>2023-05-19T21:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073450#M88035</link>
      <description>&lt;P&gt;Nope, same thing.&amp;nbsp; I'm really starting to wonder if there isn't something funny in the data that I can't see.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 21:06:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073450#M88035</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-19T21:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073453#M88036</link>
      <description>&lt;P&gt;I think you where almost there in one of your attempts. Try this:&lt;/P&gt;
&lt;P&gt;Count({$&amp;lt;[Attested_Date] = {"*"}&amp;gt;} DISTINCT([Service]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 21:43:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073453#M88036</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2023-05-19T21:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073458#M88037</link>
      <description>&lt;P&gt;Count({$&amp;lt;[Attested_Date] = {"=Len(Trim([Attested_Date])) &amp;gt; 1"}&amp;gt;} DISTINCT([Service]))&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrunPierre_0-1684534961688.png" style="width: 578px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/107614iE6D9D69E68DBF19C/image-dimensions/578x156?v=v2" width="578" height="156" role="button" title="BrunPierre_0-1684534961688.png" alt="BrunPierre_0-1684534961688.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 22:23:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073458#M88037</guid>
      <dc:creator>BrunPierre</dc:creator>
      <dc:date>2023-05-19T22:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073789#M88071</link>
      <description>&lt;P&gt;The simplest way to handle such scenarios is to replace the NULL with a real value within the data-model, for example with:&lt;/P&gt;
&lt;P&gt;coalesce(&lt;SPAN&gt;Attested_Date, '&amp;lt;NULL&amp;gt;') as&amp;nbsp;Attested_Date&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if(len(trim(Attested_Date)),&amp;nbsp;Attested_Date, '&amp;lt;NULL&amp;gt;') as&amp;nbsp;Attested_Date&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then you could directly select&amp;nbsp;&amp;lt;NULL&amp;gt; as value or using it as condition within a set analysis.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 11:11:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073789#M88071</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-05-22T11:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073968#M88087</link>
      <description>&lt;P&gt;I considered this as an option but hadn't tried it yet since, at least in my mind, the option of just ignoring the NULLs seemed appropriate.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The coalesce function is unique.&amp;nbsp; I am going to need to play around with that one.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 16:32:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073968#M88087</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-22T16:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073971#M88089</link>
      <description>&lt;P&gt;This one works.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not going back to check all the ones that I tried previously but my original formula also works again.&amp;nbsp; There must have been an anomaly somewhere that I was unaware of and couldn't find.&lt;/P&gt;
&lt;P&gt;Thanks for the help.&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 16:36:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073971#M88089</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-22T16:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073972#M88090</link>
      <description>&lt;P&gt;This one works also. It is very close to my original formula.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not going back to check all the ones that I tried previously but my original formula also works again.&amp;nbsp; There must have been an anomaly somewhere that I was unaware of and couldn't find.&lt;/P&gt;
&lt;P&gt;Thanks for the help.&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 16:37:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2073972#M88090</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-22T16:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2074078#M88097</link>
      <description>&lt;P&gt;G'day&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/211465"&gt;@rmadursk&lt;/a&gt;, I would take this one step further. What I think you are doing is counting how many distinct services there are that have been attested. I take it that being attested is an important business concept. Therefore, I would create a flag in the load script first:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;if( isnull( Attested_Date ), 0, 1 ) as isAttested&lt;/LI-CODE&gt;
&lt;P&gt;Then the set analysis becomes trivial:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count( {$&amp;lt;isAttested={1}&amp;gt;} DISTINCT([Service]) )&lt;/LI-CODE&gt;
&lt;P&gt;I hope this is a useful comment for someone.&lt;/P&gt;
&lt;P&gt;Cheers, Barnaby.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 21:37:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2074078#M88097</guid>
      <dc:creator>barnabyd</dc:creator>
      <dc:date>2023-05-22T21:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set expressions to exclude nulls and count distinct elements not working.</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2074410#M88133</link>
      <description>&lt;P&gt;I really like this idea. There are several fields/expressions that I think I can use this tactic to make my sheets less complicated.&amp;nbsp; Just have to remember to do them all before I split and unpivot the troublesome column.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 12:46:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expressions-to-exclude-nulls-and-count-distinct-elements-not/m-p/2074410#M88133</guid>
      <dc:creator>rmadursk</dc:creator>
      <dc:date>2023-05-23T12:46:04Z</dc:date>
    </item>
  </channel>
</rss>

