<?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 First sorted value or max? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/First-sorted-value-or-max/m-p/1280949#M26684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone I'm having some issues with some duplicate data. &lt;/P&gt;&lt;P&gt;We have sales basic sales data:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/154752_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;And what I'm finding is that when [Version No_] is greater than 1 I'm getting multiple (non distinct) [Document No_]. I've tried using first sorted value as well as max functions. &lt;/P&gt;&lt;P&gt;I've tried following the examples in a couple other problems but they just don't seem to jive with my table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;functions I've tried: &lt;/P&gt;&lt;P&gt;firstsortedvalue([Document No_], [Version No_]) - to see if I would get distinct Document No_&lt;/P&gt;&lt;P&gt;firstsortedvalue([Document No_], -[Version No_]) - to get only the highest number&lt;/P&gt;&lt;P&gt;firstsortedvalue(distinct([Document No_]), [Version No_]) - to see if that would give me distinct Document No_&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstsortedvalue([Version No_], [Document No_]) - same process as above&lt;/P&gt;&lt;P&gt;firstsortedvalue([Version No_], -[Document No_])&lt;/P&gt;&lt;P&gt;firstsortedvalue(distinct([Version No_]), [Document No_])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried using a SQL statement on the script to only grab the max [Version No_] which also has not worked.(This SQL statement gives me the data I need): &lt;/P&gt;&lt;P&gt;Select * from "Sales Line Archive" SLA1&lt;/P&gt;&lt;P&gt;WHERE SLA1.[Version No_] = &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select Max(SLA2.[Version No_]) from "Sales Line Archive" SLA2 Where SLA2.[Document No_] = SLA1.[Document No_]) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND ("No_" = '11001' OR "No_" = '11004' OR "No_" = '12001' OR "No_" = '13001' OR "No_" = '13003');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Feb 2017 15:47:35 GMT</pubDate>
    <dc:creator>shearwatertroy</dc:creator>
    <dc:date>2017-02-28T15:47:35Z</dc:date>
    <item>
      <title>First sorted value or max?</title>
      <link>https://community.qlik.com/t5/App-Development/First-sorted-value-or-max/m-p/1280949#M26684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone I'm having some issues with some duplicate data. &lt;/P&gt;&lt;P&gt;We have sales basic sales data:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/154752_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;And what I'm finding is that when [Version No_] is greater than 1 I'm getting multiple (non distinct) [Document No_]. I've tried using first sorted value as well as max functions. &lt;/P&gt;&lt;P&gt;I've tried following the examples in a couple other problems but they just don't seem to jive with my table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;functions I've tried: &lt;/P&gt;&lt;P&gt;firstsortedvalue([Document No_], [Version No_]) - to see if I would get distinct Document No_&lt;/P&gt;&lt;P&gt;firstsortedvalue([Document No_], -[Version No_]) - to get only the highest number&lt;/P&gt;&lt;P&gt;firstsortedvalue(distinct([Document No_]), [Version No_]) - to see if that would give me distinct Document No_&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstsortedvalue([Version No_], [Document No_]) - same process as above&lt;/P&gt;&lt;P&gt;firstsortedvalue([Version No_], -[Document No_])&lt;/P&gt;&lt;P&gt;firstsortedvalue(distinct([Version No_]), [Document No_])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried using a SQL statement on the script to only grab the max [Version No_] which also has not worked.(This SQL statement gives me the data I need): &lt;/P&gt;&lt;P&gt;Select * from "Sales Line Archive" SLA1&lt;/P&gt;&lt;P&gt;WHERE SLA1.[Version No_] = &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Select Max(SLA2.[Version No_]) from "Sales Line Archive" SLA2 Where SLA2.[Document No_] = SLA1.[Document No_]) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND ("No_" = '11001' OR "No_" = '11004' OR "No_" = '12001' OR "No_" = '13001' OR "No_" = '13003');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2017 15:47:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/First-sorted-value-or-max/m-p/1280949#M26684</guid>
      <dc:creator>shearwatertroy</dc:creator>
      <dc:date>2017-02-28T15:47:35Z</dc:date>
    </item>
  </channel>
</rss>

