<?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: Get 1st instance of max value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/823797#M290253</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Pat_ID,Date,Score&lt;/P&gt;&lt;P&gt;1111,1/1/2014,1&lt;/P&gt;&lt;P&gt;1111,2/1/2014,1&lt;/P&gt;&lt;P&gt;1111,3/1/2014,3&lt;/P&gt;&lt;P&gt;1111,4/1/2014,3&lt;/P&gt;&lt;P&gt;2222,1/1/2014,1&lt;/P&gt;&lt;P&gt;2222,2/1/2014,3&lt;/P&gt;&lt;P&gt;2222,3/1/2014,3&lt;/P&gt;&lt;P&gt;3333,1/1/2014,2&lt;/P&gt;&lt;P&gt;3333,8/1/2014,4&lt;/P&gt;&lt;P&gt;3333,9/1/2014,4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join(Table)&lt;BR /&gt;Load Pat_ID,Max(Score) As Score, 1 As Flag Resident Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Load Pat_ID,Date,Score,If(IsNull(Flag),0,If(Pat_ID = Previous(Pat_ID) And Peek(Flag) = 0,1,0) As Flag Resident Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table Table; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jan 2015 06:57:06 GMT</pubDate>
    <dc:creator>anbu1984</dc:creator>
    <dc:date>2015-01-21T06:57:06Z</dc:date>
    <item>
      <title>Get 1st instance of max value</title>
      <link>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/823796#M290252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Pat_ID,Date,Score&lt;/P&gt;&lt;P&gt;1111,1/1/2014,1&lt;/P&gt;&lt;P&gt;1111,2/1/2014,1&lt;/P&gt;&lt;P&gt;1111,3/1/2014,3&lt;/P&gt;&lt;P&gt;1111,4/1/2014,3&lt;/P&gt;&lt;P&gt;2222,1/1/2014,1&lt;/P&gt;&lt;P&gt;2222,2/1/2014,3&lt;/P&gt;&lt;P&gt;2222,3/1/2014,3&lt;/P&gt;&lt;P&gt;3333,1/1/2014,2&lt;/P&gt;&lt;P&gt;3333,8/1/2014,4&lt;/P&gt;&lt;P&gt;3333,9/1/2014,4&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is create a flag per Pat_ID that would flag the 1st instance of the max score. I would like the end table to look like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pat_ID,Date,Score, Flg_Max&lt;/P&gt;&lt;P&gt;1111,1/1/2014,1,0&lt;/P&gt;&lt;P&gt;1111,2/1/2014,1,0&lt;/P&gt;&lt;P&gt;1111,3/1/2014,3,1&lt;/P&gt;&lt;P&gt;1111,4/1/2014,3,0&lt;/P&gt;&lt;P&gt;2222,1/1/2014,1,0&lt;/P&gt;&lt;P&gt;2222,2/1/2014,3,1&lt;/P&gt;&lt;P&gt;2222,3/1/2014,3,0&lt;/P&gt;&lt;P&gt;3333,1/1/2014,2,0&lt;/P&gt;&lt;P&gt;3333,8/1/2014,4,1&lt;/P&gt;&lt;P&gt;3333,9/1/2014,4,0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated. Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 02:13:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/823796#M290252</guid>
      <dc:creator>tchovanec</dc:creator>
      <dc:date>2015-01-21T02:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get 1st instance of max value</title>
      <link>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/823797#M290253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;Load * inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Pat_ID,Date,Score&lt;/P&gt;&lt;P&gt;1111,1/1/2014,1&lt;/P&gt;&lt;P&gt;1111,2/1/2014,1&lt;/P&gt;&lt;P&gt;1111,3/1/2014,3&lt;/P&gt;&lt;P&gt;1111,4/1/2014,3&lt;/P&gt;&lt;P&gt;2222,1/1/2014,1&lt;/P&gt;&lt;P&gt;2222,2/1/2014,3&lt;/P&gt;&lt;P&gt;2222,3/1/2014,3&lt;/P&gt;&lt;P&gt;3333,1/1/2014,2&lt;/P&gt;&lt;P&gt;3333,8/1/2014,4&lt;/P&gt;&lt;P&gt;3333,9/1/2014,4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join(Table)&lt;BR /&gt;Load Pat_ID,Max(Score) As Score, 1 As Flag Resident Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final:&lt;BR /&gt;NoConcatenate&lt;BR /&gt;Load Pat_ID,Date,Score,If(IsNull(Flag),0,If(Pat_ID = Previous(Pat_ID) And Peek(Flag) = 0,1,0) As Flag Resident Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table Table; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 06:57:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/823797#M290253</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-01-21T06:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get 1st instance of max value</title>
      <link>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/1744822#M453202</link>
      <description>&lt;P&gt;Hello! I know this is an old post but I'm trying your solution for a similar application and I get an "Invalid expression" error for the Max() statement. I'm using qliksense april 2019.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've made sure the field I'm comparing is a numeric one. Any clues why this may be happening?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 15:04:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/1744822#M453202</guid>
      <dc:creator>FernandaNava</dc:creator>
      <dc:date>2020-09-17T15:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get 1st instance of max value</title>
      <link>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/1744838#M453205</link>
      <description>&lt;P&gt;the line with the Max(Score) is missing a group by expression&amp;nbsp; &lt;STRONG&gt;&lt;EM&gt;group by Pat_ID&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;having surpassed that you will of course find the if statement is missing a closing parenthesis.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 15:41:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-1st-instance-of-max-value/m-p/1744838#M453205</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-09-17T15:41:49Z</dc:date>
    </item>
  </channel>
</rss>

