<?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 Set Analysis - use of max date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148960#M27175</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your set was not right - unfortunately the syntax can make it difficult to follow.&lt;/P&gt;&lt;P&gt;This may work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;=sum({$ &amp;lt; PODate = {"$(=max(PODate,2))"} &amp;gt;} po_line.unit_price)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;However, you will note that if you select only one date that max(PODate,2) will return Null (because there is no second from max if you only select one).&lt;/P&gt;&lt;P&gt;Is this really what you want?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Jul 2009 01:20:50 GMT</pubDate>
    <dc:creator>stephencredmond</dc:creator>
    <dc:date>2009-07-12T01:20:50Z</dc:date>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148958#M27173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to sum up a unit field for a give/slected period. I can calculate the max(PODate) fine, but when I add the previous max function (i.e. max(PODate,2), it will not compute. I can even hard code a date in there, but it won't compute a function of summing up units for PODates less than a given date.&lt;/P&gt;&lt;P&gt;But, when I use the max(PODate,2) in a text box, it comes up with the correct date to use. Not sure why it is not calculating in the set analysis????&lt;/P&gt;&lt;P&gt;I have attached my qvd which is a pretty basic table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2009 01:59:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148958#M27173</guid>
      <dc:creator />
      <dc:date>2009-07-10T01:59:45Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148959#M27174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you explain what you are trying to achieve. Do you want something like the Revenue for the date = Max(date) - 1?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jul 2009 04:48:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148959#M27174</guid>
      <dc:creator />
      <dc:date>2009-07-11T04:48:01Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148960#M27175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Your set was not right - unfortunately the syntax can make it difficult to follow.&lt;/P&gt;&lt;P&gt;This may work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;=sum({$ &amp;lt; PODate = {"$(=max(PODate,2))"} &amp;gt;} po_line.unit_price)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;However, you will note that if you select only one date that max(PODate,2) will return Null (because there is no second from max if you only select one).&lt;/P&gt;&lt;P&gt;Is this really what you want?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Jul 2009 01:20:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148960#M27175</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2009-07-12T01:20:50Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148961#M27176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct in that it is not what I really want. I am having trouble with getting the next date for an item if the user selects a date. For instance, the last price of a unit. If you select August, I have not problem getting the unit price for that time, but I'm not sure how to get the last unit price. I can't use the maximum minus 1 becuase the last instance of the price for each item could be different (i.e. one month, two months, etc.). So if I select August, and the last time I bought item 1 was three months ago, and the last time I bought item 2 was two months ago, how do I get those values?&lt;/P&gt;&lt;P&gt;I was hoping the max(PODate,2) would give me the next maximum date for each unit regardless of how long ago, but I can't figure out the formula for getting it to recognize the date range when only one date is selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 03:07:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148961#M27176</guid>
      <dc:creator />
      <dc:date>2009-07-14T03:07:32Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148962#M27177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It would be fairly simple to order your pricing in the load script and then load the Previous(Price) As LastPrice. Then you would always have it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 04:15:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148962#M27177</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2009-07-14T04:15:28Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148963#M27178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That would work for the current month but not for previous months. They are trying to evaluate based on the month selected. I recommended a spark graph showing the price over time, but they still want to evaluate from a selected month. I am having a hard time summing up fields based on a range of dates given a selected month, especially if they want the last price from a selected month.&lt;/P&gt;&lt;P&gt;I now think I understand the max function better and tried&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;sum&lt;/B&gt;({$ &amp;lt; &lt;B&gt;PODate&lt;/B&gt; = {&lt;B&gt;&lt;I&gt;"$(=max({1} PODate,2))"&lt;/I&gt;&lt;/B&gt;} &amp;gt;} U&lt;B&gt;nitprice&lt;/B&gt;)&lt;/P&gt;&lt;P&gt;this will give me all of the dates, but I can't understand how to get it to evaluate a period of all dates less than the selected date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2009 01:03:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148963#M27178</guid>
      <dc:creator />
      <dc:date>2009-07-15T01:03:03Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - use of max date</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148964#M27179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I finally got the function to work. Looks like the double quotes that I was using should have been single quotes (even though all the help shows it in double quotes). Below is what finally worked for 9.0.&lt;/P&gt;&lt;H3&gt;=sum({&amp;lt;InvDate = {'&amp;gt;=$(=date(min(InvDate))) &amp;lt;=$(=max({1} InvDate))'} &amp;gt;} Issues)&lt;/H3&gt;&lt;H3&gt;Thanks for all the help - they all helped me to piece it together...&lt;/H3&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2009 05:11:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-use-of-max-date/m-p/148964#M27179</guid>
      <dc:creator />
      <dc:date>2009-07-29T05:11:04Z</dc:date>
    </item>
  </channel>
</rss>

