<?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: RE:First sorted value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447438#M807481</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi may this help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 style="margin: 0 0 10px; font-weight: 400; font-size: 2.856em; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;FirstSortedValue - chart function&lt;/H1&gt;&lt;P style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;FirstSortedValue()&lt;/SPAN&gt; returns the value from the expression specified in value that corresponds to the result of sorting the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; argument, for example, the name of the product with the lowest unit price. The nth value in the sort order, can be specified in &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt;. If more than one resulting value shares the same &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; for the specified &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt;, the function returns NULL.&lt;/P&gt;&lt;P class="syntax_heading" data-mc-autonum="Syntax: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Syntax: &lt;/SPAN&gt; &lt;/P&gt;&lt;P class="syntax" data-mc-conditions="Targets.NotToTranslate" style="font-size: 16px; margin: 10px 0; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; background-color: #f4f4f4; color: #0f0f0f;"&gt;FirstSortedValue([{SetExpression}] [DISTINCT] [TOTAL [&amp;lt;fld {,fld}&amp;gt;]] value, sort_weight [,rank])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="return_type" data-mc-autonum="Return data type: " style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber" style="font-weight: bold;"&gt;Return data type: &lt;/SPAN&gt;dual&lt;/P&gt;&lt;P class="arguments" data-mc-autonum="Arguments: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Arguments: &lt;/SPAN&gt; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-tableGrid" style="margin-bottom: 15px; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR class="Head-Header1"&gt;&lt;TH class="HeadI--" style="padding: 5px 7px; text-align: left;"&gt;Argument&lt;/TH&gt;&lt;TH class="HeadG--" style="padding: 5px 7px; text-align: left;"&gt;Description&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;value&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;Output field. The function finds the value of the expression value that corresponds to the result of sorting &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;sort_weight&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Input field. The expression containing the data to be sorted. The first (lowest) value of &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; is found, from which the corresponding value of the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;value&lt;/SPAN&gt; expression is determined. If you place a minus sign in front of &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt;, the function returns the last (highest) sorted value instead.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;rank&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;By stating a &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt; "n" larger than 1, you get the nth sorted value.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;SetExpression&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;By default, the aggregation function will aggregate over the set of possible records defined by the selection. An alternative set of records can be defined by a set analysis expression.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;DISTINCT&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;If the word &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;DISTINCT&lt;/SPAN&gt; occurs before the function arguments, duplicates resulting from the evaluation of the function arguments are disregarded.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyC--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;TOTAL&lt;/TD&gt;&lt;TD class="BodyA--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;If the word &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL&lt;/SPAN&gt; occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions.&lt;/P&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;By using &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL [&amp;lt;fld {.fld}&amp;gt;]&lt;/SPAN&gt;, where the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL&lt;/SPAN&gt; qualifier is followed by a list of one or more field names as a subset of the chart dimension variables, you create a subset of the total possible values.&lt;/P&gt;&lt;P class="see_also_inline" data-mc-autonum="See: " data-mc-conditions="Targets.WebHelpOnly" style="font-size: inherit; margin: 0 0 5px;"&gt;&lt;SPAN class="autonumber" style="font-weight: bold;"&gt;See: &lt;/SPAN&gt;&lt;A class="xref MCXref" href="http://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/ChartFunctions/define-aggregation-scope.htm" style="color: #0066cc; border-bottom: 1px solid #0066cc;"&gt;Defining the aggregation scope&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class="examples_results" data-mc-autonum="Examples and results: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Examples and results: &lt;/SPAN&gt; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-ZebraTable" style="margin-bottom: 15px; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px; margin-right: auto;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR data-mc-conditions="Targets.NotToTranslate"&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;Customer&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;Product&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;UnitSales&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadG--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;UnitPrice&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;4&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;10&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;BB&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;9&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;BB&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;5&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;CC&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;2&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;DD&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;-&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Canutility&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;8&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Canutility&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;CC&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;-&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyA--Body2" data-mc-conditions="" style="padding: 7px;"&gt;19&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE cellspacing="0" class="TableStyle-tableGrid" style="margin: 40px auto 15px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR class="Head-Header1"&gt;&lt;TH class="HeadI--" style="padding: 5px 7px; text-align: left;"&gt;Example&lt;/TH&gt;&lt;TH class="HeadG--" style="padding: 5px 7px; text-align: left;"&gt;Result&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Product, UnitPrice)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;BB, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt;with the lowest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(9).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Product, UnitPrice, 2)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;BB, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt;with the second-lowest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(10).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, -UnitPrice, 2)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Betacab, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt;with the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt; that has second-highest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(20).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, UnitPrice, 3)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;NULL, because there are two values of &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt; (Astrida and Canutility) with the same&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;rank&lt;/SPAN&gt; (third-lowest) &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(15).&lt;/P&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Use the distinct qualifier to make sure unexpected null results do not occur.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyC--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, -UnitPrice*UnitSales, 2)&lt;/TD&gt;&lt;TD class="BodyA--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Canutility, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt; with the second-highest sales order value &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;multiplied by &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitSales&lt;/SPAN&gt; (120).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;Data used in examples:&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;ProductData:&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;LOAD * inline [&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Customer|Product|UnitSales|UnitPrice&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|AA|4|16&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|AA|10|15&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|BB|9|9&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|BB|5|10&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|CC|2|20&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|DD||25&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Canutility|AA|8|15&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Canutility|CC||19&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;] (delimiter is '|');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jan 2018 09:57:39 GMT</pubDate>
    <dc:creator>subhash_gherade</dc:creator>
    <dc:date>2018-01-10T09:57:39Z</dc:date>
    <item>
      <title>RE:First sorted value</title>
      <link>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447436#M807479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am new to Qlik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In which scenario First sorted value function used&amp;nbsp; can anyone give with simple example to understand better&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447436#M807479</guid>
      <dc:creator>kicchu465</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: RE:First sorted value</title>
      <link>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447437#M807480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this,&lt;/P&gt;&lt;P&gt;&lt;A href="https://qlikcentral.com/2014/08/13/firstsortedvalue/" title="https://qlikcentral.com/2014/08/13/firstsortedvalue/"&gt;https://qlikcentral.com/2014/08/13/firstsortedvalue/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-6907"&gt;Using FirstSortedValue in the Script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Hirish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2017 12:51:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447437#M807480</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2017-10-27T12:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: RE:First sorted value</title>
      <link>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447438#M807481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi may this help &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1 style="margin: 0 0 10px; font-weight: 400; font-size: 2.856em; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;FirstSortedValue - chart function&lt;/H1&gt;&lt;P style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;FirstSortedValue()&lt;/SPAN&gt; returns the value from the expression specified in value that corresponds to the result of sorting the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; argument, for example, the name of the product with the lowest unit price. The nth value in the sort order, can be specified in &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt;. If more than one resulting value shares the same &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; for the specified &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt;, the function returns NULL.&lt;/P&gt;&lt;P class="syntax_heading" data-mc-autonum="Syntax: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Syntax: &lt;/SPAN&gt; &lt;/P&gt;&lt;P class="syntax" data-mc-conditions="Targets.NotToTranslate" style="font-size: 16px; margin: 10px 0; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; background-color: #f4f4f4; color: #0f0f0f;"&gt;FirstSortedValue([{SetExpression}] [DISTINCT] [TOTAL [&amp;lt;fld {,fld}&amp;gt;]] value, sort_weight [,rank])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="return_type" data-mc-autonum="Return data type: " style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber" style="font-weight: bold;"&gt;Return data type: &lt;/SPAN&gt;dual&lt;/P&gt;&lt;P class="arguments" data-mc-autonum="Arguments: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Arguments: &lt;/SPAN&gt; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-tableGrid" style="margin-bottom: 15px; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR class="Head-Header1"&gt;&lt;TH class="HeadI--" style="padding: 5px 7px; text-align: left;"&gt;Argument&lt;/TH&gt;&lt;TH class="HeadG--" style="padding: 5px 7px; text-align: left;"&gt;Description&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;value&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;Output field. The function finds the value of the expression value that corresponds to the result of sorting &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;sort_weight&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Input field. The expression containing the data to be sorted. The first (lowest) value of &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt; is found, from which the corresponding value of the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;value&lt;/SPAN&gt; expression is determined. If you place a minus sign in front of &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;sort_weight&lt;/SPAN&gt;, the function returns the last (highest) sorted value instead.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;rank&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;By stating a &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;rank&lt;/SPAN&gt; "n" larger than 1, you get the nth sorted value.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;SetExpression&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;By default, the aggregation function will aggregate over the set of possible records defined by the selection. An alternative set of records can be defined by a set analysis expression.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;DISTINCT&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;If the word &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;DISTINCT&lt;/SPAN&gt; occurs before the function arguments, duplicates resulting from the evaluation of the function arguments are disregarded.&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyC--" data-mc-conditions="Targets.NotToTranslate" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;TOTAL&lt;/TD&gt;&lt;TD class="BodyA--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;If the word &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL&lt;/SPAN&gt; occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions.&lt;/P&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;By using &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL [&amp;lt;fld {.fld}&amp;gt;]&lt;/SPAN&gt;, where the &lt;SPAN class="statement" data-mc-conditions="Targets.NotToTranslate" style="font-weight: bold;"&gt;TOTAL&lt;/SPAN&gt; qualifier is followed by a list of one or more field names as a subset of the chart dimension variables, you create a subset of the total possible values.&lt;/P&gt;&lt;P class="see_also_inline" data-mc-autonum="See: " data-mc-conditions="Targets.WebHelpOnly" style="font-size: inherit; margin: 0 0 5px;"&gt;&lt;SPAN class="autonumber" style="font-weight: bold;"&gt;See: &lt;/SPAN&gt;&lt;A class="xref MCXref" href="http://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/ChartFunctions/define-aggregation-scope.htm" style="color: #0066cc; border-bottom: 1px solid #0066cc;"&gt;Defining the aggregation scope&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P class="examples_results" data-mc-autonum="Examples and results: " style="font-size: 14px; margin: 10px 0; font-weight: bold; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;&lt;SPAN class="autonumber"&gt;Examples and results: &lt;/SPAN&gt; &lt;/P&gt;&lt;TABLE cellspacing="0" class="TableStyle-ZebraTable" style="margin-bottom: 15px; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px; margin-right: auto;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR data-mc-conditions="Targets.NotToTranslate"&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;Customer&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;Product&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadI--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;UnitSales&lt;/TH&gt;&lt;TH class="TableStyle-ZebraTable-HeadG--" data-mc-conditions="" style="padding: 5px 7px; text-align: left;"&gt;UnitPrice&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;4&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;10&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Astrida&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;BB&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;9&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;BB&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;5&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;CC&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;2&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Betacab&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;DD&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body2" data-mc-conditions="" style="padding: 7px;"&gt;-&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body2" data-mc-conditions="" style="padding: 7px;"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body1" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;Canutility&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;AA&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyF--Body1" data-mc-conditions="" style="padding: 7px;"&gt;8&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyD--Body1" data-mc-conditions="" style="padding: 7px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="TableStyle-ZebraTable-Body-Body2" data-mc-conditions="Targets.NotToTranslate" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;Canutility&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;CC&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyC--Body2" data-mc-conditions="" style="padding: 7px;"&gt;-&lt;/TD&gt;&lt;TD class="TableStyle-ZebraTable-BodyA--Body2" data-mc-conditions="" style="padding: 7px;"&gt;19&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE cellspacing="0" class="TableStyle-tableGrid" style="margin: 40px auto 15px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif; font-size: 14px;"&gt;&lt;THEAD style="border-top: 2px solid #0f0f0f;"&gt;&lt;TR class="Head-Header1"&gt;&lt;TH class="HeadI--" style="padding: 5px 7px; text-align: left;"&gt;Example&lt;/TH&gt;&lt;TH class="HeadG--" style="padding: 5px 7px; text-align: left;"&gt;Result&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="border-top-width: 2px; border-top-color: #0f0f0f;"&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Product, UnitPrice)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;BB, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt;with the lowest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(9).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Product, UnitPrice, 2)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;BB, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt;with the second-lowest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(10).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, -UnitPrice, 2)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Betacab, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt;with the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Product&lt;/SPAN&gt; that has second-highest &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(20).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyI--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, UnitPrice, 3)&lt;/TD&gt;&lt;TD class="BodyG--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;NULL, because there are two values of &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt; (Astrida and Canutility) with the same&lt;SPAN data-mc-conditions="Targets.NotToTranslate"&gt;rank&lt;/SPAN&gt; (third-lowest) &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;(15).&lt;/P&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Use the distinct qualifier to make sure unexpected null results do not occur.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR class="Body-Body1" style="border-bottom-width: 1px; border-bottom-color: #d5d5d5;"&gt;&lt;TD class="BodyC--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;firstsortedvalue (Customer, -UnitPrice*UnitSales, 2)&lt;/TD&gt;&lt;TD class="BodyA--" style="padding: 7px; border: 1px solid #d5d5d5;"&gt;&lt;P style="font-size: inherit; margin: 0 0 5px;"&gt;Canutility, which is the &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;Customer&lt;/SPAN&gt; with the second-highest sales order value &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitPrice&lt;/SPAN&gt;multiplied by &lt;SPAN class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px;"&gt;UnitSales&lt;/SPAN&gt; (120).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-size: 14px; margin: 10px 0; color: #0f0f0f; font-family: 'Open Sans', Arial, sans-serif;"&gt;Data used in examples:&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;ProductData:&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;LOAD * inline [&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Customer|Product|UnitSales|UnitPrice&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|AA|4|16&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|AA|10|15&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Astrida|BB|9|9&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|BB|5|10&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|CC|2|20&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Betacab|DD||25&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Canutility|AA|8|15&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;Canutility|CC||19&lt;/P&gt;&lt;P class="Code" data-mc-conditions="Targets.NotToTranslate" style="font-size: 12px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; color: #0f0f0f;"&gt;] (delimiter is '|');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 09:57:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/RE-First-sorted-value/m-p/1447438#M807481</guid>
      <dc:creator>subhash_gherade</dc:creator>
      <dc:date>2018-01-10T09:57:39Z</dc:date>
    </item>
  </channel>
</rss>

