<?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: How to get a row value when I use Max() ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521031#M481855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a straight table chart with dimension ItemNo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then two expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=max(Qty)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= FirstSortedValue(Distinct Date, -Qty)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added a distinct qualifier, so you get a date back when you have two dates with same Qty for the same ItemNo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: I missed that you may have several entries per date and ItemNo and you need to aggregate.&lt;/P&gt;&lt;P&gt;If you don't want to do that in the script, you can try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Max(aggr(Sum(Qty),ItemNo,Date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=FirstSortedValue( aggr(Date,ItemNo,Date), aggr(-sum(Qty),ItemNo,Date) )&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Sep 2013 15:50:21 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-09-13T15:50:21Z</dc:date>
    <item>
      <title>How to get a row value when I use Max() ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521030#M481854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm really new to QlikView, amazed so far, but having now a problem, for which I can't find a solution by myself and the forum (maybe I don't know the right keywords...) &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have a inline table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Data:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LOAD * INLINE [&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ItemNo, Qty, Date&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;44444, 100, 24.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;55555, 300, 24.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;77777, 200, 24.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;55555, 200, 25.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;66666, 500, 25.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;77777, 300, 25.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to get the highest quantity and the corresponding date by ItemNo.&lt;/P&gt;&lt;P&gt;So the goal is getting this (in a straight table): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ItemNo, Max, Date&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;44444, 100, 24.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;55555, 300, 24.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;66666, 500, 25.01.2013&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;77777, 300, 25.01.2013&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Max I'm using the expression &lt;STRONG&gt;=Max(aggr(Sum(Qty),ItemNo,Date))&lt;/STRONG&gt; (sum up if I have more than one entry a day)&lt;/P&gt;&lt;P&gt;But how do I get the corresponding date now? Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd prefer a solution not done in the load script, because I think it should be able to do something like this by the end user themselves &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/plain.png" /&gt;But if it's the only way, then say it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help and idea!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards and have a nice weekend&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: I have only the personal edition, so a written idea/solution would be appreciated &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 15:30:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521030#M481854</guid>
      <dc:creator />
      <dc:date>2013-09-13T15:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a row value when I use Max() ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521031#M481855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a straight table chart with dimension ItemNo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then two expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=max(Qty)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= FirstSortedValue(Distinct Date, -Qty)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added a distinct qualifier, so you get a date back when you have two dates with same Qty for the same ItemNo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: I missed that you may have several entries per date and ItemNo and you need to aggregate.&lt;/P&gt;&lt;P&gt;If you don't want to do that in the script, you can try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Max(aggr(Sum(Qty),ItemNo,Date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=FirstSortedValue( aggr(Date,ItemNo,Date), aggr(-sum(Qty),ItemNo,Date) )&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 15:50:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521031#M481855</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-09-13T15:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a row value when I use Max() ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521032#M481856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;Load ItemNo, max(Qty) as Max, firstsortedvalue(Date, -Qty) as MaxDate&lt;/P&gt;&lt;P&gt;resident Data&lt;/P&gt;&lt;P&gt;group by ItemNo;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 15:50:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521032#M481856</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-09-13T15:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a row value when I use Max() ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521033#M481857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jawoll! Awesome, thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 16:41:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-a-row-value-when-I-use-Max/m-p/521033#M481857</guid>
      <dc:creator />
      <dc:date>2013-09-13T16:41:49Z</dc:date>
    </item>
  </channel>
</rss>

