<?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 Get date where count distinct is lowest in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070263#M87775</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I have the following example of data:&lt;/P&gt;
&lt;P&gt;date1,type,field1&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'aaa','v1'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'aaa','v2'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'bbb','v3'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'aaa','v1'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'bbb','v5'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'bbb','v1'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a kpi where I show the &lt;STRONG&gt;date1&lt;/STRONG&gt; with de minimum &lt;U&gt;&lt;STRONG&gt;measure1&lt;/STRONG&gt; &lt;/U&gt;(&lt;EM&gt;count(distinct field1)&lt;/EM&gt;) and the &lt;EM&gt;date1&lt;/EM&gt; that gets this minimum &lt;EM&gt;measure1&lt;/EM&gt;. If one &lt;EM&gt;date1&lt;/EM&gt; doesn't have data (in this case, 2023-01-02 has not data), this &lt;EM&gt;date1&lt;/EM&gt; has to be the one with the minimum &lt;EM&gt;measure1&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;I have loaded a calendar with the list of the possible date1, in this case from 2023-01-01 to 2023-01-03 (including 2023-01-02), just Qlik to know all dates have to be analysed.&lt;/P&gt;
&lt;P&gt;So,&lt;/P&gt;
&lt;P&gt;date1, measure1&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,3&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;2023-01-02&lt;/FONT&gt;,0&lt;/STRONG&gt;&lt;/U&gt; --&amp;gt; min&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have &lt;EM&gt;measure1&lt;/EM&gt; as follows (&lt;EM&gt;date1 &lt;STRONG&gt;(&lt;/STRONG&gt;min(field1)&lt;STRONG&gt;)):&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;FirstSortedValue({State1*State2}distinct date1, Aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0),date1)))&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;amp; ' (' &amp;amp; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Min({State1*State2}aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0), date1)) &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;amp; ')'&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This works, but the problem is that when I filter &lt;STRONG&gt;type&lt;/STRONG&gt; dimension values, measure1 breaks. If&amp;nbsp; I select 'aaa' value of &lt;EM&gt;type&lt;/EM&gt; dimension, 2023-01-02 is still the &lt;EM&gt;date1&lt;/EM&gt; with the lowest amount. I guess the problem is I'm not including &lt;EM&gt;type&lt;/EM&gt; inside aggr function, but If I do so It doesn't work.&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2023 14:48:23 GMT</pubDate>
    <dc:creator>amaaiia</dc:creator>
    <dc:date>2023-05-11T14:48:23Z</dc:date>
    <item>
      <title>Get date where count distinct is lowest</title>
      <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070263#M87775</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;I have the following example of data:&lt;/P&gt;
&lt;P&gt;date1,type,field1&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'aaa','v1'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'aaa','v2'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,'bbb','v3'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'aaa','v1'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'bbb','v5'&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,'bbb','v1'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a kpi where I show the &lt;STRONG&gt;date1&lt;/STRONG&gt; with de minimum &lt;U&gt;&lt;STRONG&gt;measure1&lt;/STRONG&gt; &lt;/U&gt;(&lt;EM&gt;count(distinct field1)&lt;/EM&gt;) and the &lt;EM&gt;date1&lt;/EM&gt; that gets this minimum &lt;EM&gt;measure1&lt;/EM&gt;. If one &lt;EM&gt;date1&lt;/EM&gt; doesn't have data (in this case, 2023-01-02 has not data), this &lt;EM&gt;date1&lt;/EM&gt; has to be the one with the minimum &lt;EM&gt;measure1&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;I have loaded a calendar with the list of the possible date1, in this case from 2023-01-01 to 2023-01-03 (including 2023-01-02), just Qlik to know all dates have to be analysed.&lt;/P&gt;
&lt;P&gt;So,&lt;/P&gt;
&lt;P&gt;date1, measure1&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;2023-01-01&lt;/FONT&gt;,3&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;2023-01-02&lt;/FONT&gt;,0&lt;/STRONG&gt;&lt;/U&gt; --&amp;gt; min&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;2023-01-03&lt;/FONT&gt;,2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have &lt;EM&gt;measure1&lt;/EM&gt; as follows (&lt;EM&gt;date1 &lt;STRONG&gt;(&lt;/STRONG&gt;min(field1)&lt;STRONG&gt;)):&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;FirstSortedValue({State1*State2}distinct date1, Aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0),date1)))&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;amp; ' (' &amp;amp; &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Min({State1*State2}aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0), date1)) &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;amp; ')'&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This works, but the problem is that when I filter &lt;STRONG&gt;type&lt;/STRONG&gt; dimension values, measure1 breaks. If&amp;nbsp; I select 'aaa' value of &lt;EM&gt;type&lt;/EM&gt; dimension, 2023-01-02 is still the &lt;EM&gt;date1&lt;/EM&gt; with the lowest amount. I guess the problem is I'm not including &lt;EM&gt;type&lt;/EM&gt; inside aggr function, but If I do so It doesn't work.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 14:48:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070263#M87775</guid>
      <dc:creator>amaaiia</dc:creator>
      <dc:date>2023-05-11T14:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get date where count distinct is lowest</title>
      <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070344#M87781</link>
      <description>&lt;P&gt;Hi try this .&lt;/P&gt;
&lt;P&gt;FirstSortedValue({State1*State2} distinct date1,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Aggr(if(len(concat(field1)) &amp;gt; 0, count({State1*State2} distinct field1), 0), date1, type)&lt;/P&gt;
&lt;P&gt;) &amp;amp; ' (' &amp;amp;&lt;/P&gt;
&lt;P&gt;Min({State1*State2} aggr(if(len(concat(field1)) &amp;gt; 0, count({State1*State2} distinct field1), 0), date1, type))&lt;/P&gt;
&lt;P&gt;&amp;amp;&lt;/P&gt;
&lt;P&gt;')'&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 17:41:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070344#M87781</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2023-05-11T17:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get date where count distinct is lowest</title>
      <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070588#M87810</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149241"&gt;@amaaiia&lt;/a&gt;&lt;/SPAN&gt;,&lt;BR /&gt;&lt;BR /&gt;If you modify your expression to include the type dimension in the Aggr function, like below is it helping ?&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;FirstSortedValue({State1*State2}distinct date1, Aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0),date1,type))&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;&amp;amp; ' (' &amp;amp;&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;Min({State1*State2}aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2}distinct field1),0), date1,type))&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;&amp;amp; ')'&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
&lt;P&gt;Benoit&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 10:48:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070588#M87810</guid>
      <dc:creator>Benoit_C</dc:creator>
      <dc:date>2023-05-12T10:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get date where count distinct is lowest</title>
      <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070597#M87811</link>
      <description>&lt;P&gt;No, it doesn't work, I've already tried it. Also the problem is that I have some other dimension that I can filter, not only &lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 11:15:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070597#M87811</guid>
      <dc:creator>amaaiia</dc:creator>
      <dc:date>2023-05-12T11:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get date where count distinct is lowest</title>
      <link>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070691#M87822</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="color:var(--ck-color-mention-text);"&gt;&lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149241"&gt;@amaaiia&lt;/a&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;,&lt;BR /&gt;&lt;BR /&gt;You could try using a set analysis expression to ignore the selections in those dimensions. For example:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;FirstSortedValue({State1*State2}distinct date1, Aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2&amp;lt;type=&amp;gt;}distinct field1),0),date1))&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;&amp;amp; ' (' &amp;amp;&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;Min({State1*State2}aggr(if(len(concat(field1))&amp;gt;0,count({State1*State2&amp;lt;type=&amp;gt;}distinct field1),0), date1))&lt;/I&gt;&lt;BR /&gt;&lt;I&gt;&amp;amp; ')'&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;Does that work ?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Benoit&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 14:04:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Get-date-where-count-distinct-is-lowest/m-p/2070691#M87822</guid>
      <dc:creator>Benoit_C</dc:creator>
      <dc:date>2023-05-12T14:04:01Z</dc:date>
    </item>
  </channel>
</rss>

