<?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 Record corresponding to max date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149936#M28038</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A typical way to do this is to use IntervalMatch to generate a row for each product/date combination in the range. For this exact scenario, see the QV Cookbook example "Fill values in a data range using previous values.". This example is just like your price problem. You can download the Cookbook from &lt;A href="http://robwunderlich.com/Download.html"&gt;http://robwunderlich.com/Download.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It has been pointed out that this solution does not work well for a large number of items, as you will have (items * dates) rows. It may work ok with your dataset. I've been meaning to work up another solution with Set Analysis that does not require IntervalMatch. Perhaps someone will post one here...&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jul 2009 06:50:17 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2009-07-22T06:50:17Z</dc:date>
    <item>
      <title>Record corresponding to max date</title>
      <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149935#M28037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey guys, I'm new to qlikview....this may be very easy for you but I'm totally stuck.&lt;/P&gt;&lt;P&gt;I have a calendar which displays the date. I have a table that contains different prices at different dates for the same product. When a particular "date" is selected on the calendar, I want to display the price of the product corresponding to the maximum date that is less than selected date...&lt;/P&gt;&lt;P&gt;here is an example....[Price, Date] [2.25, 01/01/2007] [3.25, 03/01/2008] [4.25,06/01/2009]....When I select 01/01/2009 in the calendar, the price should be displayed as 3.25&lt;/P&gt;&lt;P&gt;I greatly appreciate your help on this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 05:45:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149935#M28037</guid>
      <dc:creator />
      <dc:date>2009-07-22T05:45:41Z</dc:date>
    </item>
    <item>
      <title>Record corresponding to max date</title>
      <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149936#M28038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A typical way to do this is to use IntervalMatch to generate a row for each product/date combination in the range. For this exact scenario, see the QV Cookbook example "Fill values in a data range using previous values.". This example is just like your price problem. You can download the Cookbook from &lt;A href="http://robwunderlich.com/Download.html"&gt;http://robwunderlich.com/Download.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It has been pointed out that this solution does not work well for a large number of items, as you will have (items * dates) rows. It may work ok with your dataset. I've been meaning to work up another solution with Set Analysis that does not require IntervalMatch. Perhaps someone will post one here...&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 06:50:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149936#M28038</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-07-22T06:50:17Z</dc:date>
    </item>
    <item>
      <title>Record corresponding to max date</title>
      <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149937#M28039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way would be to use an intervalmatch() to establish a price for every day. But if we extend your problem to be by timestamp instead of just by date, that is no longer a practical solution, which tells me it probably isn't the best solution.&lt;/P&gt;&lt;P&gt;Attached is another approach, but the expression is kind of ridiculous for such a simple concept, so there almost has to be a better way. But I figured a couple bad solutions might be better than no solution.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;=max(aggr(if("Price Date"=date(max(aggr(if("Price Date"&amp;lt;=max("Date"),"Price Date"),"Price Date"))),"Price"),"Price Date"))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 06:50:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149937#M28039</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-22T06:50:24Z</dc:date>
    </item>
    <item>
      <title>Record corresponding to max date</title>
      <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149938#M28040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And here's a set analysis version. Again, while less ugly, a pretty ugly expression, and I suspect there's a better one still:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;max({&amp;lt;Date={'$(=date(max({&amp;lt;Price-={},Date={"&amp;lt;=$(=date(max(Date)))"}&amp;gt;}Date)))'}&amp;gt;}Price)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 07:09:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149938#M28040</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-22T07:09:16Z</dc:date>
    </item>
    <item>
      <title>Record corresponding to max date</title>
      <link>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149939#M28041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rob and John. Although you guys seem to think it's ugly, I'm getting it to work exactly as I wanted.&lt;/P&gt;&lt;P&gt;Thanks very much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 22:30:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-corresponding-to-max-date/m-p/149939#M28041</guid>
      <dc:creator />
      <dc:date>2009-07-22T22:30:05Z</dc:date>
    </item>
  </channel>
</rss>

