<?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, but only once per dimension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1899573#M74266</link>
    <description>&lt;P&gt;You could try this expression:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;=-SUM(Clinic=aggr(nodistinct FirstSortedValue(Clinic, -VisitDate),PatientID))&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 20:22:42 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2022-03-02T20:22:42Z</dc:date>
    <item>
      <title>Count distinct, but only once per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1899542#M74262</link>
      <description>&lt;P&gt;I have a table with a dimension (Clinic) and a measure (count of distinct patients who had a visit). How can I make the measure count patients only once in the table, for their most recent visit?&lt;/P&gt;
&lt;P&gt;For example, the Clinic dimension has values 'Clinic A' and 'Clinic B.' If patient Mary went to both clinics, she should be counted in the 'Clinic A' row because she went there most recently.&lt;/P&gt;
&lt;P&gt;In the data model, the fields are all in one table: Clinic, PatientID, VisitDate.&lt;/P&gt;
&lt;P&gt;Should I use set analysis with Aggr?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 18:54:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1899542#M74262</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2022-03-02T18:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, but only once per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1899573#M74266</link>
      <description>&lt;P&gt;You could try this expression:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;=-SUM(Clinic=aggr(nodistinct FirstSortedValue(Clinic, -VisitDate),PatientID))&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 20:22:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1899573#M74266</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2022-03-02T20:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, but only once per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1900925#M74327</link>
      <description>&lt;P&gt;Thank you, &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/25001"&gt;@Vegar&lt;/a&gt;&amp;nbsp;. I don't completely understand. Do you mean that can be my measure expression? Or is that set analysis inside of count(distinct PatientID)? It looks like set analysis but without {} and &amp;lt;&amp;gt; brackets.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 04:11:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-distinct-but-only-once-per-dimension/m-p/1900925#M74327</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2022-03-04T04:11:57Z</dc:date>
    </item>
  </channel>
</rss>

