<?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: Looking up latest valid value using ApplyMap in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926812#M647735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might also want to look at this sample:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Qlikview Cookbook: Expand A Pricing Date Table &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/recipes/download-info/expand-a-pricing-date-table/" rel="nofollow"&gt;http://qlikviewcookbook.com/recipes/download-info/expand-a-pricing-date-table/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Nov 2015 01:21:38 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2015-11-18T01:21:38Z</dc:date>
    <item>
      <title>Looking up latest valid value using ApplyMap</title>
      <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926809#M647729</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 have an Excel pricing file which looks like this:&lt;/P&gt;&lt;P&gt;PriceTable:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Price&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100003474&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/10/2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;100003475&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/09/2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then I have some data in a table which looks like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QtyTable:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Qty&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;100003474&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/10/2015&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;100003475&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;01/10/2015&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;What I would like to do is make a 4th column in my QtyTable which would calculate the correct value of my quantity. Ideally if there is a match between the ID&amp;amp;Date fields then use that price however if this lookup fails then I would like to take the latest available date for the ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example Row 1) When looking at Row 1 of my QtyTable I would expect to return the price 300 and therefore the 4th column should be 10*300 = 3000 since the ID&amp;amp;Date combination can be matched exactly across both the PriceTable and QtyTable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example Row 2) When looking at Row 2 of my QtyTable I would expect for this first lookup to fail as the ID&amp;amp;Date combination does not exist in the PriceTable but it should then revert to assigning the latest available price which is 200 in this case so the 4th column should be 10*200 = 2000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 22:13:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926809#M647729</guid>
      <dc:creator>rileymd88</dc:creator>
      <dc:date>2015-11-17T22:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Looking up latest valid value using ApplyMap</title>
      <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926810#M647733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mapping:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mapping&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD ID, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Date, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstSortedValue(Qty, -Date) as Qty&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="2061" data-containertype="14" data-objectid="191846" data-objecttype="1" href="https://community.qlik.com/thread/191846"&gt;https://community.qlik.com/thread/191846&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @2)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By ID;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD ID, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Price&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="2061" data-containertype="14" data-objectid="191846" data-objecttype="1" href="https://community.qlik.com/thread/191846"&gt;https://community.qlik.com/thread/191846&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Table)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD ID, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="2061" data-containertype="14" data-objectid="191846" data-objecttype="1" href="https://community.qlik.com/thread/191846"&gt;https://community.qlik.com/thread/191846&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @2);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Price * Qty as Sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD ID,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Price,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(IsNull(Qty), ApplyMap('Mapping', ID), Qty) as Qty&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&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;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/105830_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 22:22:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926810#M647733</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-17T22:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Looking up latest valid value using ApplyMap</title>
      <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926811#M647734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you want to find a match in price table with the latest date &amp;lt;= the date in the qty table, so a fixed mapping based on&amp;nbsp; ID only will not work for a history of qty data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC has blogged a lot about these problems and also created some tech docs.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-3786"&gt;Generating Missing Data In QlikView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you find several approaches including generating the missing price records in the data model and INTERVALMATCH approaches. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 22:36:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926811#M647734</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-11-17T22:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Looking up latest valid value using ApplyMap</title>
      <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926812#M647735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might also want to look at this sample:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Qlikview Cookbook: Expand A Pricing Date Table &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/recipes/download-info/expand-a-pricing-date-table/" rel="nofollow"&gt;http://qlikviewcookbook.com/recipes/download-info/expand-a-pricing-date-table/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 01:21:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926812#M647735</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-11-18T01:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Looking up latest valid value using ApplyMap</title>
      <link>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926813#M647736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks for your help. I ended up fixing this by creating a lookup key of ID&amp;amp;Price and looking this up and then if it failed I would apply another ApplyMap against a sorted list which always shows the latest dates and prices so the latest price is always applied.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2015 08:49:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looking-up-latest-valid-value-using-ApplyMap/m-p/926813#M647736</guid>
      <dc:creator>rileymd88</dc:creator>
      <dc:date>2015-11-27T08:49:10Z</dc:date>
    </item>
  </channel>
</rss>

