<?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: Using First Sorted Value to get a Maximum Value in a Range in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-First-Sorted-Value-to-get-a-Maximum-Value-in-a-Range/m-p/1125855#M520829</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the p() function isn't right and would rather try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;firstsortedvalue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ({&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClaimID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;SPAN style="font-size: 8pt;"&gt;{&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;firstsortedvalue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClaimID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jun 2016 15:08:37 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2016-06-28T15:08:37Z</dc:date>
    <item>
      <title>Using First Sorted Value to get a Maximum Value in a Range</title>
      <link>https://community.qlik.com/t5/QlikView/Using-First-Sorted-Value-to-get-a-Maximum-Value-in-a-Range/m-p/1125854#M520828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I closed the other post.&amp;nbsp;&amp;nbsp; I have now isolated my issue.&amp;nbsp; I need to return the Max HistoryID value for each claim.&amp;nbsp; I have successfully done that using the following expression:&lt;/P&gt;&lt;P&gt;=Max(aggr(firstsortedvalue (HistoryID, -EventDate), ClaimID)) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, what I really need is the Max HistoryID where the corresponding EventDate is &amp;lt;= my end Date range.&amp;nbsp; I thought I could use the (p) function and replace "HistoryID" with the expression {&amp;lt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;P&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;})&amp;gt;}, &lt;/SPAN&gt;to identify those HistoryID's.&amp;nbsp; My syntax is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;firstsortedvalue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;P&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;})&amp;gt;}, -&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClaimID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;The syntax appears correct but it doesn't bring anything back.&amp;nbsp; Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 01:06:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-First-Sorted-Value-to-get-a-Maximum-Value-in-a-Range/m-p/1125854#M520828</guid>
      <dc:creator />
      <dc:date>2016-06-28T01:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using First Sorted Value to get a Maximum Value in a Range</title>
      <link>https://community.qlik.com/t5/QlikView/Using-First-Sorted-Value-to-get-a-Maximum-Value-in-a-Range/m-p/1125855#M520829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the p() function isn't right and would rather try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;firstsortedvalue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ({&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClaimID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;SPAN style="font-size: 8pt;"&gt;{&amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;firstsortedvalue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;HistoryID&lt;/SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EventDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClaimID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 15:08:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-First-Sorted-Value-to-get-a-Maximum-Value-in-a-Range/m-p/1125855#M520829</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-06-28T15:08:37Z</dc:date>
    </item>
  </channel>
</rss>

