<?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 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538002#M201083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;FirstSortedValue returns Null when more than 1 value share the same lowest order, certainly why you have blanks when data is grouped. Maybe you need another critera to ensure there's always 1 value; you can also try FirstSortedValue(Distinct ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jan 2014 16:46:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-01-20T16:46:49Z</dc:date>
    <item>
      <title>FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538001#M201082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have load a table with warehouse handling, with positive and negative &lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;movements from the first movement to now (ex. ITEM, date, sign, and other fields).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;I use a pivot table to sum and get the warehouse actual quantity per item and I &lt;/SPAN&gt;&lt;/SPAN&gt;need to find last price per item:&lt;/P&gt;&lt;P&gt;DATE (year, month, day), ITEM as dimension, QUANTITY, LAST PRICE, VALUE (column 1 * column 2) as expressions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* selection: today (so that i sum every movements from the first to today and get actual quantity; but the user can change the date "to" to another, like if he want to know the quantity per item until 31/12/2012 for example and in that option the "last price" is to be the last price until 31/12/2012 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use FirstSortedValue and it seems to work ok but only in the detail level (year\month\day\item ok; if I group to day or month or year sometimes the "last price" is blank and so the "value" column).&lt;/P&gt;&lt;P&gt;(is a bit more complex because I need to switch from 2 different cost with a variable set by the user and not consider day/month/year selections )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue({$&amp;lt;year=, month=, day= , magDate={"&amp;lt;=$(vDataRifUS)"}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Aggr({$&amp;lt;year=, month=, day= , magDate={"&amp;lt;=$(=vDataRifUS)"}&amp;gt;}&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( vCostType=1, magCost, magCost2), magItem, magDate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;,&amp;nbsp; -magDate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not know why is computed only in the 4 level (detail with item).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any idea about the blanks when columns are grouped?&lt;/P&gt;&lt;P&gt;or idea to get the last price &lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;dynamically ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;Thanks!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 16:40:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538001#M201082</guid>
      <dc:creator />
      <dc:date>2014-01-20T16:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538002#M201083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;FirstSortedValue returns Null when more than 1 value share the same lowest order, certainly why you have blanks when data is grouped. Maybe you need another critera to ensure there's always 1 value; you can also try FirstSortedValue(Distinct ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 16:46:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538002#M201083</guid>
      <dc:creator />
      <dc:date>2014-01-20T16:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538003#M201084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When two or more lines 'ties' to aggregation level, FirstSortedValue will return "null".&lt;/P&gt;&lt;P&gt;You should provide a "untie" value enabling FirstSortedValue to choose wich value it should return&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 00:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue/m-p/538003#M201084</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2014-01-21T00:38:47Z</dc:date>
    </item>
  </channel>
</rss>

