<?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 Analysis Distinct Count in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1938473#M77347</link>
    <description>&lt;P&gt;the ask "&lt;EM&gt;sum my PBT field for those clients in Europe but no other Region&lt;/EM&gt;" pretty much sounds like the same thing.&amp;nbsp; you just replace the field&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Mastergroup&lt;BR /&gt;&lt;BR /&gt;with whatever field you want to sum.&amp;nbsp; if both solution worked for you then you can do either for the new field&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 16:15:25 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2022-06-01T16:15:25Z</dc:date>
    <item>
      <title>Set Analysis Distinct Count in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935676#M77095</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I'm trying to produce a KPI to show how many clients we serve in Europe that we don't serve elsewhere.&amp;nbsp; I've already defined a Master Measure&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;&lt;EM&gt;Region_Count&lt;/EM&gt; as&amp;nbsp;&lt;EM&gt;Count( distinct Region)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;My expression for No. of clients is:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=count( distinct {&amp;lt;Region_Count={1}, Region = {"HBEU"}&amp;gt;} Mastergroup)&lt;/LI-CODE&gt;
&lt;P&gt;However, this is showing all European clients, including those we serve elsewhere.&amp;nbsp; So it appears to be ignoring the first condition in the set analysis.&amp;nbsp; Can anyone see my (probably obvious) mistake?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 18:54:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935676#M77095</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-11-02T18:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935685#M77098</link>
      <description>&lt;P&gt;Try the exclude function:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;count(distinct {&amp;lt;Region={'HBEU'}, Mastergroup=e({&amp;lt;Region-={'HBEU'}&amp;gt;}Mastergroup)&amp;gt;}Mastergroup)

count where Region = HBEU and excludes Mastergroup where Region &amp;lt;&amp;gt; HBEU&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 18:55:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935685#M77098</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-11-02T18:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935686#M77099</link>
      <description>&lt;P&gt;May be try something like this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;Region = {"HBEU"}&amp;gt;} Aggr(If(Count(DISTINCT Region) = 1, 1, 0), Mastergroup))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 16:55:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1935686#M77099</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2022-05-25T16:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1937763#M77299</link>
      <description>&lt;P&gt;Wow thanks - both solutions did exactly what I asked for (and they're both far too complex for me to have figured out myself!)&lt;/P&gt;
&lt;P&gt;How would I build on this, for example to sum my PBT field for those clients in Europe but no other Region?&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 13:27:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1937763#M77299</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-05-31T13:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1938473#M77347</link>
      <description>&lt;P&gt;the ask "&lt;EM&gt;sum my PBT field for those clients in Europe but no other Region&lt;/EM&gt;" pretty much sounds like the same thing.&amp;nbsp; you just replace the field&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Mastergroup&lt;BR /&gt;&lt;BR /&gt;with whatever field you want to sum.&amp;nbsp; if both solution worked for you then you can do either for the new field&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 16:15:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1938473#M77347</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-06-01T16:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1938951#M77384</link>
      <description>&lt;P&gt;Simply replacing that field just returns a count, rather than the Sum.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 12:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1938951#M77384</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-06-02T12:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1939132#M77406</link>
      <description>&lt;P&gt;you are saying when you use the expression sum({&amp;lt;...&amp;gt;}PBT), it returns a count and not a sum?&amp;nbsp; i dont think thats a Qlik issue but a data issue.&amp;nbsp; to troubleshoot it, i suggest you create 2 measures: one with an actual count and one with a sum.&amp;nbsp; if there is no difference, you have to do a deeper dive.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 18:30:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1939132#M77406</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2022-06-02T18:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1939808#M77472</link>
      <description>&lt;P&gt;Here are my two expressions, which I've adapted slightly from the solutions I was given:&lt;/P&gt;
&lt;P&gt;Count of Mastergroup:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;Region = {"HBAP"}, Sector -={"Exit", "Other GB&amp;amp;M"}, Product -={"Other"}&amp;gt;} Aggr(If(Count(DISTINCT Region) = 1, 1, 0), Mastergroup))&lt;/LI-CODE&gt;
&lt;P&gt;Sum of PBT:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;Region = {"HBAP"}, Sector -={"Exit", "Other GB&amp;amp;M"}, Product -={"Other"}&amp;gt;} Aggr(If(Count(DISTINCT Region) = 1, 1, 0), PBT))&lt;/LI-CODE&gt;
&lt;P&gt;Here's how it appears in the KPI:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="njimack_1-1654500489346.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/81041i9C612473A6C38A05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="njimack_1-1654500489346.png" alt="njimack_1-1654500489346.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But here's the raw data.&amp;nbsp; PBT for those 6 clients should sum to $22.5:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="njimack_2-1654500772772.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/81042i9B112E725BD0DC13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="njimack_2-1654500772772.png" alt="njimack_2-1654500772772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can see that the expression is counting the number of rows that have a distinct PBT value.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 07:34:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1939808#M77472</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-06-06T07:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1940184#M77493</link>
      <description>&lt;P&gt;I figured it out eventually...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Sum({&amp;lt;Region = {"HBAP"}, Sector -={"Exit", "Other GB&amp;amp;M"}, Product -={"Other"}&amp;gt;} Aggr(If(Count(DISTINCT Region) = 1, SUM(PBT), 0), Mastergroup)) &lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 07 Jun 2022 07:57:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1940184#M77493</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-06-07T07:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Distinct Count</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1940442#M77518</link>
      <description>&lt;P&gt;Still struggling to get my head round this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm now trying similar analysis for clients in 2 specific regions (HBEU and HBAP) but no other regions.&amp;nbsp; Here's my best attempt so far, but it's not working.&amp;nbsp; It's including clients that are in HBEU + LATAM or HABP + MENA&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Sum({
&amp;lt;Region = {"HBEU"}, Region -={"HBUS","LATAM","MENA"},Sector -={"Exit", "Other GB&amp;amp;M"}, Product -={"Other"}&amp;gt;
+&amp;lt;Region = {"HBAP"}, Region -={"HBUS","LATAM","MENA"},Sector -={"Exit", "Other GB&amp;amp;M"}, Product -={"Other"}&amp;gt;
} 
Aggr(If(Count(DISTINCT Region) = 2, Sum(PBT), 0), Mastergroup))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 14:02:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Distinct-Count-in-Qlik-Sense/m-p/1940442#M77518</guid>
      <dc:creator>njimack</dc:creator>
      <dc:date>2022-06-07T14:02:32Z</dc:date>
    </item>
  </channel>
</rss>

