<?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: Count(Distinct) in an IF statement in the Load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251087#M864260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Match(PROVIDER,'W','R') and WildMatch([PROC CODE],'7*'),0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF([REG FSC] = '61', 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(WildMatch(MODIFIER,'A*','B*','C*'),0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(LOC_GROUP = 'DYL' and [POST DATE] - [SERV DATE] &amp;lt;= 45, 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(LOC_GROUP = 'HOS' and [POST DATE] - [SERV DATE] &amp;lt;= 3, 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,COUNT(DISTINCT CASE)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ))))) as OUTLIER&lt;/P&gt;&lt;P&gt;Group by SOMETHING.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Dec 2016 22:29:45 GMT</pubDate>
    <dc:creator>MK_QSL</dc:creator>
    <dc:date>2016-12-29T22:29:45Z</dc:date>
    <item>
      <title>Count(Distinct) in an IF statement in the Load script</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251085#M864258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use a Count(Distinct) inside a nested IF statement in the script Load statement,but it does not seem to work. It does work fine as an expression though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;IF((PROVIDER='W' AND [PROC CODE] like '7*')OR(PROVIDER='R' AND [PROC CODE] like '7*'),0,&lt;/P&gt;&lt;P&gt;IF([REG FSC]=61,0,&lt;/P&gt;&lt;P&gt;IF((MODIFIER like 'A*') OR (MODIFIER like 'B*') OR (MODIFIER like 'C'),0,&lt;/P&gt;&lt;P&gt;IF((LOC_GROUP='DYL')AND([POST DATE]-[SERV DATE])&amp;lt;='45',0,&lt;/P&gt;&lt;P&gt;IF((LOC_GROUP='HOS')AND([POST DATE]-[SERV DATE])&amp;lt;=3,0,COUNT(DISTINCT(CASE))))))) AS OUTLIER&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251085#M864258</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count(Distinct) in an IF statement in the Load script</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251086#M864259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In order to use any aggregation functions in the load script, you should add a GROUP BY clause to your load. In order to make it work, you should include all the fields that are used in your IF conditions, as the GROUP BY dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you can simply assign OUTLIER = CASE when the condition is true and not aggregate in script. Then, you could aggregated in chart using Count(Distinct OUTLIER)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;Upgrade your Qlik skills at the &lt;A href="http://masterssummit.com/"&gt;Masters Summit for Qlik&lt;/A&gt; - coming soon to Munich, Germany!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 22:20:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251086#M864259</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2016-12-29T22:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count(Distinct) in an IF statement in the Load script</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251087#M864260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Match(PROVIDER,'W','R') and WildMatch([PROC CODE],'7*'),0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF([REG FSC] = '61', 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(WildMatch(MODIFIER,'A*','B*','C*'),0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(LOC_GROUP = 'DYL' and [POST DATE] - [SERV DATE] &amp;lt;= 45, 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF(LOC_GROUP = 'HOS' and [POST DATE] - [SERV DATE] &amp;lt;= 3, 0&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,COUNT(DISTINCT CASE)&lt;/P&gt;&lt;P&gt;&amp;nbsp; ))))) as OUTLIER&lt;/P&gt;&lt;P&gt;Group by SOMETHING.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 22:29:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-in-an-IF-statement-in-the-Load-script/m-p/1251087#M864260</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2016-12-29T22:29:45Z</dc:date>
    </item>
  </channel>
</rss>

