<?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: Firstsortedvalue for Tied values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2028099#M1222263</link>
    <description>&lt;P&gt;Both the solutions worked.&lt;/P&gt;
&lt;P&gt;Swuehl's :&amp;nbsp;FirstSortedValue(ProductName, Aggr(Count(ProductName)-1 / (Sum(CustomerSales)),ProductName))&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;Rwunderlich's :&amp;nbsp;FirstSortedValue(ProductName, Aggr(Min( Aggr(Count(ProductName) + (Sum(CustomerSales) * .000001),ProductName)),ProductName))&lt;/P&gt;
&lt;P&gt;Thanks a lot guys!&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2023 05:46:27 GMT</pubDate>
    <dc:creator>GeorgePhilips2302</dc:creator>
    <dc:date>2023-01-20T05:46:27Z</dc:date>
    <item>
      <title>Firstsortedvalue for Tied values</title>
      <link>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027742#M1222254</link>
      <description>&lt;P&gt;Attached file contains a pivot table in excel format.&lt;/P&gt;
&lt;P&gt;I have to use a Firstsortedvalue function to return the product name with minimum Count()&lt;/P&gt;
&lt;P&gt;Since there are three products with the same value, a null is returned.&lt;/P&gt;
&lt;P&gt;So I want the Product name which is least in count and the least in Sum(Sales) as the output of my firstsorted function.&lt;/P&gt;
&lt;P&gt;Please help me frame the formula!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 12:44:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027742#M1222254</guid>
      <dc:creator>GeorgePhilips2302</dc:creator>
      <dc:date>2023-01-19T12:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Firstsortedvalue for Tied values</title>
      <link>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027926#M1222255</link>
      <description>&lt;P&gt;Try to use something like the sum of&lt;/P&gt;
&lt;P&gt;Count() - 1 /&amp;nbsp; Sum(Sales)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as the FirstSortedValue() sort weight&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:57:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027926#M1222255</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2023-01-19T16:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Firstsortedvalue for Tied values</title>
      <link>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027934#M1222257</link>
      <description>&lt;P&gt;For the record, FirstSortedValue does have an optional DISTINCT parameter that is useful when there is a tie.&amp;nbsp; Probably not what you want because it just picks the first of the ties.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, you have a rule you want to use in a tie -- lowest Sales. So add sales as a small bias to your expression like:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;FirstSortedValue(ProductName,&amp;nbsp;&amp;nbsp;Min( Aggr(Count(ProductName) &lt;STRONG&gt;+ (Sum(CustomerSales) * .000001)&lt;/STRONG&gt;,ProductName))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:03:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2027934#M1222257</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2023-01-19T17:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Firstsortedvalue for Tied values</title>
      <link>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2028099#M1222263</link>
      <description>&lt;P&gt;Both the solutions worked.&lt;/P&gt;
&lt;P&gt;Swuehl's :&amp;nbsp;FirstSortedValue(ProductName, Aggr(Count(ProductName)-1 / (Sum(CustomerSales)),ProductName))&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;Rwunderlich's :&amp;nbsp;FirstSortedValue(ProductName, Aggr(Min( Aggr(Count(ProductName) + (Sum(CustomerSales) * .000001),ProductName)),ProductName))&lt;/P&gt;
&lt;P&gt;Thanks a lot guys!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 05:46:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Firstsortedvalue-for-Tied-values/m-p/2028099#M1222263</guid>
      <dc:creator>GeorgePhilips2302</dc:creator>
      <dc:date>2023-01-20T05:46:27Z</dc:date>
    </item>
  </channel>
</rss>

