<?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: How to return smallest value if FirstSortedValue finds two values? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670397#M63643</link>
    <description>&lt;P&gt;I am not just looking at the value on the Max Date, but Max Date where Value is the minimum. So, if the max date is 43859 and there are two values associated with it (100 and 200)... the second part of the FirstSortedValue will look not just by 43859, but &lt;STRONG&gt;43859 - (100/10,000,000,000)&lt;/STRONG&gt; and &lt;STRONG&gt;43859 - (200/10,000,000,000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Based on the two new values, the max will be the Amount associated with&amp;nbsp;&lt;STRONG&gt;43859 - (100/10,000,000,000)&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2020 11:28:11 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2020-01-29T11:28:11Z</dc:date>
    <item>
      <title>How to return smallest value if FirstSortedValue finds two values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670140#M63639</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;I've encountered the following problem. My expression&amp;nbsp;&lt;EM&gt;FirstSortedValue(Amount, -Date)&amp;nbsp;&lt;/EM&gt;sometimes returns NULL because there are two or more values found for a specific Date. Now I could use DISTINCT but I would have no control over which value is returned as it based on load order. I want to always return the smallest value while utilizing the ranking of FirstSortedValue. How can I achieve that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:13:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670140#M63639</guid>
      <dc:creator>Almen</dc:creator>
      <dc:date>2024-11-16T19:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to return smallest value if FirstSortedValue finds two values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670176#M63640</link>
      <description>&lt;P&gt;&lt;EM&gt;min(FirstSortedValue(Amount, -Date))&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 18:34:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670176#M63640</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2020-01-28T18:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to return smallest value if FirstSortedValue finds two values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670181#M63641</link>
      <description>&lt;P&gt;May be this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FirstSortedValue(Amount, -(Date - (Amount/1E10)))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Jan 2020 18:58:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670181#M63641</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-01-28T18:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to return smallest value if FirstSortedValue finds two values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670322#M63642</link>
      <description>&lt;P&gt;Hey guys, thanks for the quick replies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Min(FirstSortedValue, ..., ...))&amp;nbsp;&lt;/EM&gt;can not work because nested aggregations are not allowed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FirstSortedValue(Amount, -(Date - (Amount/1E10)))&lt;/EM&gt; seems to work fine, however I don't quite understand&amp;nbsp;the reason behind this. Would you be able to explain your solution?&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, 29 Jan 2020 08:20:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670322#M63642</guid>
      <dc:creator>Almen</dc:creator>
      <dc:date>2020-01-29T08:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to return smallest value if FirstSortedValue finds two values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670397#M63643</link>
      <description>&lt;P&gt;I am not just looking at the value on the Max Date, but Max Date where Value is the minimum. So, if the max date is 43859 and there are two values associated with it (100 and 200)... the second part of the FirstSortedValue will look not just by 43859, but &lt;STRONG&gt;43859 - (100/10,000,000,000)&lt;/STRONG&gt; and &lt;STRONG&gt;43859 - (200/10,000,000,000)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Based on the two new values, the max will be the Amount associated with&amp;nbsp;&lt;STRONG&gt;43859 - (100/10,000,000,000)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 11:28:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-return-smallest-value-if-FirstSortedValue-finds-two/m-p/1670397#M63643</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-01-29T11:28:11Z</dc:date>
    </item>
  </channel>
</rss>

