<?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: Max date with apply map in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601543#M678459</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd do it a little bit simpler, with one time access to the source data and no applymap:&lt;/P&gt;&lt;P&gt;OderData:&lt;BR /&gt;LOAD &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orderdate as [Max oderdate],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment&lt;BR /&gt;FROM &lt;H&gt; (biff, embedded labels);&lt;/H&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;INNER JOIN (OderData) LOAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(orderdate) as [Max oderdate]&lt;BR /&gt;RESIDENT OderData&lt;BR /&gt;GROUP BY Region;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2014 12:37:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-05-06T12:37:21Z</dc:date>
    <item>
      <title>Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601542#M678458</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;I am working on a set of data containing multiple dates.&amp;nbsp; The goal is for each item to define what the maximum date is.&lt;/P&gt;&lt;P&gt;I am using therefore the apply map function.&lt;/P&gt;&lt;P&gt;Could you please let me know if this is the most efficient methodology to do so.&lt;/P&gt;&lt;P&gt;Many thanks in advance for your help and have a great day. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kristel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached you will find the spreadsheet used as an example and the qvd file.&lt;/P&gt;&lt;P&gt;Hope you will be able to read this is.&lt;/P&gt;&lt;P&gt;If not here is the script;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN style="text-decoration: underline;"&gt;Regiongrouping&lt;/SPAN&gt;:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;mapping load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Region,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (max(orderdate))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;H&gt;&lt;/H&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(biff, embedded labels)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;group by Region;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;OderData:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Region, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orderdate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; applyMap ('Regiongrouping', Region) as [Max oderdate],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;H&gt;&lt;/H&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(biff, embedded labels);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make sure the load is focussing on the max date only we could close with:&lt;/P&gt;&lt;P&gt;Where &lt;EM&gt;orderdate&lt;/EM&gt;=&lt;EM&gt;[Max oderdate];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But is it the best way???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 10:41:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601542#M678458</guid>
      <dc:creator />
      <dc:date>2014-05-06T10:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601543#M678459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd do it a little bit simpler, with one time access to the source data and no applymap:&lt;/P&gt;&lt;P&gt;OderData:&lt;BR /&gt;LOAD &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orderdate as [Max oderdate],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment&lt;BR /&gt;FROM &lt;H&gt; (biff, embedded labels);&lt;/H&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;INNER JOIN (OderData) LOAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(orderdate) as [Max oderdate]&lt;BR /&gt;RESIDENT OderData&lt;BR /&gt;GROUP BY Region;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 12:37:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601543#M678459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-06T12:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601544#M678460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another possibility would be to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;OrderData:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Region, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orderdate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region&amp;amp;'-'&amp;amp;date(orderdate,'YYYYMMDD') as [RegionIndex],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;H&gt;&lt;/H&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(biff, embedded labels);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;RegionLast:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Region, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(orderdate) as [Max order date]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident OrderData&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Group by Region;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;RegionLast1:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Region&amp;amp;'-'&amp;amp;date([Max order date],'YYYYMMDD') as RegionIndex,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'1' as Region_LastFlag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident RegionLast;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table RegionLast;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;left join (OrderData)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; RegionIndex,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Region_LastFlag as Region_IsLast&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;resident RegionLast1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table RegionLast1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;RegionDetailsLast:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Region, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orderdate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Region_IsLast,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;resident OrderData&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;where Region_IsLast = '1';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table OrderData;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you think?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now when you have different scenario, how do you evaluate them on efficiency?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kristel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 13:26:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601544#M678460</guid>
      <dc:creator />
      <dc:date>2014-05-06T13:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601545#M678461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kristel,&lt;/P&gt;&lt;P&gt;Instead of doing it so complex,&lt;/P&gt;&lt;P&gt;just do one thing.Use the aggr() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No need to use any mapping load.Use a straight table .add one more calculated dimension.in that use the aggr() function.In the expression just write any 1 and then hide the expression.You will find your desired answer.&lt;/P&gt;&lt;P&gt;the aggr() function will be like&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&lt;SPAN style="font-size: 8pt;"&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;orderdate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Region&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;IMG alt="Capture.PNG" class="jive-image" src="https://community.qlik.com/legacyfs/online/58423_Capture.PNG" style="width: 620px; height: 543px;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope u understood.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 14:14:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601545#M678461</guid>
      <dc:creator />
      <dc:date>2014-05-06T14:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601546#M678462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kristel,&lt;/P&gt;&lt;P&gt;I don't see why do you need a long and complex script while you can have it short and simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/142639"&gt;Biren Agrawalla&lt;/A&gt;,&lt;BR /&gt;As a rule, it is better to have actual fields rather than calculated dimensions - same result but better performance.&amp;nbsp; Still your solution makes sense if the max date is not the absolute max date per Region but within current date selection.&amp;nbsp; Even in this case, I'd rather move this expression from calculated dimension to expression.&amp;nbsp; And, in expression, no need to aggr() because Region is a dimension already, simply:&lt;BR /&gt;max(orderdate)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 15:26:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601546#M678462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-06T15:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601547#M678463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the aggr() approach is a fast solution to get results on the fly. However, as data volume increases, having a calculated dimension can become so heavy for your application, impacting in performance times.&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So if you have access to script is better to make as much pre-calculations as you can in script,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 15:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601547#M678463</guid>
      <dc:creator>jaimeaguilar</dc:creator>
      <dc:date>2014-05-06T15:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Max date with apply map</title>
      <link>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601548#M678464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Micheal,&lt;/P&gt;&lt;P&gt;Thanks for the solution.But I know this is not a properway of doing as we have many other ways as well.&lt;/P&gt;&lt;P&gt;But I just posted my thought because this can also be a way of solving.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its better if we will come to know about as many possible types of solutions for a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Biren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 09:18:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-date-with-apply-map/m-p/601548#M678464</guid>
      <dc:creator />
      <dc:date>2014-05-07T09:18:36Z</dc:date>
    </item>
  </channel>
</rss>

