<?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 FirstSortValue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752154#M1035895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello frnds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one explain me what is FirstSortValue() and where we can use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with an example&lt;/P&gt;&lt;P&gt;please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jan 2015 07:20:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-01-08T07:20:20Z</dc:date>
    <item>
      <title>FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752154#M1035895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello frnds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can any one explain me what is FirstSortValue() and where we can use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with an example&lt;/P&gt;&lt;P&gt;please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 07:20:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752154#M1035895</guid>
      <dc:creator />
      <dc:date>2015-01-08T07:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752155#M1035896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;watch this video it explains about all your doubts&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=-YsJmdzMHbs" title="https://www.youtube.com/watch?v=-YsJmdzMHbs"&gt;QlikView | Expressions | AGGR Function with Max and FirstSortedValue function - YouTube&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Harsha &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 07:26:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752155#M1035896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-08T07:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752156#M1035897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it will give the first value of expression based on the sort wait ,sort wait should be numeric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date and sales u have fields&lt;/P&gt;&lt;P&gt;date:&lt;/P&gt;&lt;P&gt;1/1/2014&lt;/P&gt;&lt;P&gt;2/1/2014&lt;/P&gt;&lt;P&gt;3/1/2014&lt;/P&gt;&lt;P&gt;4/1/2014&lt;/P&gt;&lt;P&gt;5/1/2014&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sales:&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;200&lt;/P&gt;&lt;P&gt;300&lt;/P&gt;&lt;P&gt;600&lt;/P&gt;&lt;P&gt;500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here u want see the top value and bottom value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstsortedvalue(date,-sales)&amp;nbsp; in chart if u written then it gives top value&lt;/P&gt;&lt;P&gt;firstsortedvalue(date,sales) in chart if u written then it gives bottom value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 07:32:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752156#M1035897</guid>
      <dc:creator />
      <dc:date>2015-01-08T07:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752157#M1035898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check this&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/30532"&gt;FirstSortedValue()&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 07:33:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752157#M1035898</guid>
      <dc:creator>arulsettu</dc:creator>
      <dc:date>2015-01-08T07:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752158#M1035899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hello Rahim,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here you go&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Firstsortedvalue()&lt;BR /&gt; &lt;/STRONG&gt;This function returns the first value of the expression sorted by corresponding sort-weight when the expression is executed over a number of records as defined by a group by clause. Sort-weight returns a numeric value where the lowest value will render the corresponding value of the expression to be sorted first.&lt;BR /&gt; &lt;STRONG&gt;Syntax&lt;BR /&gt; &lt;/STRONG&gt;firstsortedvalue ([ distinct ] expression [, sort-weight [, n ]])&lt;BR /&gt; &lt;/P&gt;&lt;P style="text-align: justify;"&gt;Let us take a scenario, where we have to identify Product Name that sold the most during selected period by company. To do so, we have to use &lt;STRONG&gt;AGGR&lt;/STRONG&gt; function in conjunction with function &lt;STRONG&gt;FIRSTSORTEDVALUE().&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;STRONG&gt;FIRSTSORTEDVALUE&lt;/STRONG&gt; function return the first value of expression sorted by corresponding sort-weight. Sort weight should be numeric value and it returns NULL value if more than one expression value share the same sort order so if there is tie in sorting it returns NULL value unless you do some thing else to overcome this issue.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;To extract the last sorted value which is opposite to first sorted value, we need to add a minus sign (-) to sort weight expression. We can also use set analysis and Total in &lt;STRONG&gt;FIRSTSORTEDVALUE&lt;/STRONG&gt; function.&lt;/P&gt;&lt;P style="text-align: justify;"&gt;Syntax:- FIRSTSORTVALUE( Field, Sort-Weight)&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;A href="http://www.analyticsvidhya.com/blog/wp-content/uploads/2014/02/AGGR_FIRSTSORTEDVALUE_Qlikview1.png"&gt;&lt;IMG alt="AGGR_FIRSTSORTEDVALUE_Qlikview" class="size-full wp-image-2367 alignnone" height="283" src="http://www.analyticsvidhya.com/blog/wp-content/uploads/2014/02/AGGR_FIRSTSORTEDVALUE_Qlikview1.png" width="608" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;As mentioned above, to identify name of Product based on highest sales product by company, we have to write expression like :&lt;/P&gt;&lt;P style="text-align: justify;"&gt;&lt;STRONG&gt;=FIRSTSORTEDVALUE (Product, – aggr(sum(Sale),Company_Name,Product) )&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="text-align: justify;"&gt;In above expression, AGGR statement generates a virtual table that has total sales by company and product. Then, FIRSTSORTEDVALUE function identifies the &lt;STRONG&gt;Product Name&lt;/STRONG&gt; from the virtual table for highest sale. Because aggr function is preceded by minus sign (-), it will return product name against highest sales.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 07:44:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752158#M1035899</guid>
      <dc:creator />
      <dc:date>2015-01-08T07:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752159#M1035900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #444444; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px;"&gt;Hello Rahim,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #444444; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #444444; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px;"&gt;You can use FirstSortedValue both in the script and user interface (UI) of QlikView.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #444444; font-size: 11.8181819915771px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;FirstSortedValue works when loading aggregated (grouped) data &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px; margin-bottom: 1.75em; color: #444444;"&gt;Here we have a simple table showing when a customer bought a particular product:&lt;/P&gt;&lt;P&gt;&lt;A href="https://qlikcentral.files.wordpress.com/2014/08/picture1.jpg" style="font-family: inherit; font-size: 11.8181819915771px; font-style: inherit; font-weight: inherit; color: #0da4d3;"&gt;&lt;IMG alt="QlikView FirstSortedValue" class="wp-image-427 jive-image size-medium" height="195" src="http://qlikcentral.files.wordpress.com/2014/08/picture1.jpg?w=450&amp;amp;h=293" style="border: 0px; margin: 0 0 5px;" width="300" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P class="wp-caption-text" style="font-family: inherit; font-size: 0.916666666666667em; font-style: inherit; font-weight: inherit; margin-top: 5px; margin-bottom: 5px; color: #888888;"&gt;&lt;/P&gt;&lt;P class="wp-caption-text" style="font-family: inherit; font-size: 0.916666666666667em; font-style: inherit; font-weight: inherit; margin-top: 5px; margin-bottom: 5px; color: #888888;"&gt;&lt;SPAN style="color: #444444; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px; line-height: 1.5em;"&gt;Loading the data grouped by Customer we can use the DayOfSale as the sort-weight, position 1 and return the value of product.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 11.8181819915771px; margin-bottom: 1.75em; color: #444444;"&gt;Customer:&lt;BR /&gt;Load&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Customer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,FirstSortedValue(Product,DayOfSale,1) as FirstProductBought&lt;BR /&gt;Resident Customers_Temp&lt;BR /&gt;Group by Customer&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikView FirstSortedValue" class="jive-image size-full wp-image-432" height="47" src="http://qlikcentral.files.wordpress.com/2014/08/grouped.png?w=470" style="margin: 0 0 5px;" width="191" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 09:01:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortValue/m-p/752159#M1035900</guid>
      <dc:creator>tyagishaila</dc:creator>
      <dc:date>2015-01-08T09:01:47Z</dc:date>
    </item>
  </channel>
</rss>

