<?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: Display max value based on dimensions values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556905#M1141015</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andre,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case you can use the below code to create another flag. It orders by Description and Key and assigns "1" for the description with max(Key).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FinalTable:&lt;/P&gt;&lt;P&gt;load DESCRIPTION, VALUE,KEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(DESCRIPTION=Previous(DESCRIPTION),0,1) as Flag &lt;/P&gt;&lt;P&gt;Resident SourceTable&lt;/P&gt;&lt;P&gt;Order by DESCRIPTION,KEY desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add Description and Value as dimensions and Flag as expression. It will display only the records which have flag=1 (the ones with the highest value of KEY). If you do not wish to show the FLAG column in the front end, go to presentation tab and hide the column. I have added a few more rows to your data just to make sure... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/46838_Capture.PNG.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;Manas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Sep 2013 21:54:01 GMT</pubDate>
    <dc:creator>manas_bn</dc:creator>
    <dc:date>2013-09-23T21:54:01Z</dc:date>
    <item>
      <title>Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556899#M1141009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to QlikView and I'm trying to accomplish something that seems to me quite easy, but couldn't find the solution so far. I have one table like the next one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KEY;DESCRIPTION;VALUE&lt;/P&gt;&lt;P&gt;1;Desc1;Value1&lt;/P&gt;&lt;P&gt;2;Desc1;Value2&lt;/P&gt;&lt;P&gt;3;Desc2;Value3&lt;/P&gt;&lt;P&gt;4;Desc2;Value4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I retrieve the value for the max KEY aggregated by description. The correct output would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2;Desc1;Value2&lt;/P&gt;&lt;P&gt;4;Desc2;Value4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to build a chart where the Description is the dimension and I only want to display the value for the maximum key (no sums or counts).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it was in SQL it would be something like this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select max(key), description, value from table&lt;/P&gt;&lt;P&gt;group by description, value;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 17:26:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556899#M1141009</guid>
      <dc:creator />
      <dc:date>2013-09-23T17:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556900#M1141010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If DESCRIPTION is the only dimension, you can just use Max(KEY) as the expression.&lt;/P&gt;&lt;P&gt;Else, you can use aggr function - aggr(max(KEY),DESCRIPTION)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Manas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 18:13:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556900#M1141010</guid>
      <dc:creator>manas_bn</dc:creator>
      <dc:date>2013-09-23T18:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556901#M1141011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load max(key) as Key, description, value from table&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;group by description, value;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Or&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Description as dimension, max(Key) and Sum(value) as expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 18:16:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556901#M1141011</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2013-09-23T18:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556902#M1141012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to limit the no of rows during reload itself, you can use left join, like in the below code.&lt;/P&gt;&lt;P&gt;source:&lt;/P&gt;&lt;P&gt;load * Inline [&lt;/P&gt;&lt;P&gt;KEY,DESCRIPTION,VALUE&lt;/P&gt;&lt;P&gt;1,Desc1,Value1&lt;/P&gt;&lt;P&gt;2,Desc1,Value2&lt;/P&gt;&lt;P&gt;3,Desc2,Value3&lt;/P&gt;&lt;P&gt;4,Desc2,Value4];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;final:&lt;/P&gt;&lt;P&gt;load DESCRIPTION, max(KEY) as KEY Resident source&lt;/P&gt;&lt;P&gt;Group by DESCRIPTION;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(final)&lt;/P&gt;&lt;P&gt;load KEY, DESCRIPTION,VALUE Resident source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop Table source;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 18:19:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556902#M1141012</guid>
      <dc:creator>manas_bn</dc:creator>
      <dc:date>2013-09-23T18:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556903#M1141013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked into AGGR function too&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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;max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;key&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),description&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 18:19:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556903#M1141013</guid>
      <dc:creator />
      <dc:date>2013-09-23T18:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556904#M1141014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I already took a look at the aggr function. If I use aggr(max(KEY),DESCRIPTION), it will return me the maximum key for every description. But how can I filter the expression just to retrieve the VALUE at the maximum KEY for every DESCRIPTION?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the presented example, I want a chart that contains a column with Desc1 and Value1, and another column with Desc2 and Value 4 without restricting the data being loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 18:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556904#M1141014</guid>
      <dc:creator />
      <dc:date>2013-09-23T18:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556905#M1141015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andre,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case you can use the below code to create another flag. It orders by Description and Key and assigns "1" for the description with max(Key).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FinalTable:&lt;/P&gt;&lt;P&gt;load DESCRIPTION, VALUE,KEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(DESCRIPTION=Previous(DESCRIPTION),0,1) as Flag &lt;/P&gt;&lt;P&gt;Resident SourceTable&lt;/P&gt;&lt;P&gt;Order by DESCRIPTION,KEY desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add Description and Value as dimensions and Flag as expression. It will display only the records which have flag=1 (the ones with the highest value of KEY). If you do not wish to show the FLAG column in the front end, go to presentation tab and hide the column. I have added a few more rows to your data just to make sure... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/46838_Capture.PNG.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;Manas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 21:54:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556905#M1141015</guid>
      <dc:creator>manas_bn</dc:creator>
      <dc:date>2013-09-23T21:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Display max value based on dimensions values</title>
      <link>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556906#M1141016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can do it at graph time using "FirstSortedValue" as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;DESCRIPTION&lt;/SPAN&gt;,-KEY) and&lt;/P&gt;&lt;P&gt;FirstSortedValue(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;VALUE&lt;/SPAN&gt;,-KEY)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2013 22:03:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-max-value-based-on-dimensions-values/m-p/556906#M1141016</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-09-23T22:03:52Z</dc:date>
    </item>
  </channel>
</rss>

