<?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 Top value in expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Top-value-in-expression/m-p/336235#M124042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I'm having trouble using the "top" function within an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a description of my problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a history of product purchase with the date, the price and the product ID.&lt;/P&gt;&lt;P&gt;I also have "typical usage sheet" with a list of product ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The goal is to compute the total sheet price for a certain date by looking into the purchase history.&lt;/P&gt;&lt;P&gt;As I don't have a product price for each date, I would like to choose the nearset entry in the history.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking to order the result by date difference and to take the top one. But I'm not sure how I should do this in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the productID as a dimention in a pivot table and "top(productPrice)" as en expression thinking it would give me each product the first price in the data. But it doesn't work, it returns me a null value for each product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit : So I guess I should use something lik firstsortedvalue(productPrice, datediff). But the problem is that if I have two price with the same datediff, the function will return null. How could I still have a result ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 08:12:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-04-04T08:12:46Z</dc:date>
    <item>
      <title>Top value in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Top-value-in-expression/m-p/336235#M124042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I'm having trouble using the "top" function within an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a description of my problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a history of product purchase with the date, the price and the product ID.&lt;/P&gt;&lt;P&gt;I also have "typical usage sheet" with a list of product ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The goal is to compute the total sheet price for a certain date by looking into the purchase history.&lt;/P&gt;&lt;P&gt;As I don't have a product price for each date, I would like to choose the nearset entry in the history.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking to order the result by date difference and to take the top one. But I'm not sure how I should do this in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the productID as a dimention in a pivot table and "top(productPrice)" as en expression thinking it would give me each product the first price in the data. But it doesn't work, it returns me a null value for each product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit : So I guess I should use something lik firstsortedvalue(productPrice, datediff). But the problem is that if I have two price with the same datediff, the function will return null. How could I still have a result ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 08:12:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-value-in-expression/m-p/336235#M124042</guid>
      <dc:creator />
      <dc:date>2012-04-04T08:12:46Z</dc:date>
    </item>
  </channel>
</rss>

