<?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: Set Analysis MAX(DATE) Not resolving in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521353#M685277</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Phill,&lt;/P&gt;&lt;P&gt;Please check out the attached file and see if it meets your requirement.&lt;/P&gt;&lt;P&gt;I put two text boxes. One of them calculates the max date for each MatterId and the other sums the BilledAmount corresponding to those max dates for each ID. &lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;AJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2014 15:54:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-01-16T15:54:12Z</dc:date>
    <item>
      <title>Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521347#M685267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I'm trying to do a simple sum for a list of matters.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I want 2 values per matter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;1, the last Bill Date which is working fine with:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=DATE(AGGR(MAX(BILL_DATE), MATTER_ID))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;2, The last Bill value, which i thought doing BILL_DATE = the above would work, but isn't.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MONEY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&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;SUM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;BILL_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"=$(=NUM(AGGR(MAX(BILL_DATE), MATTER_ID)))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;BILLED_AMOUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;MATTER_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Any help, greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 14:42:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521347#M685267</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T14:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521348#M685269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Phill,&lt;/P&gt;&lt;P&gt;Try FirstSortedValue(), maybe:&lt;/P&gt;&lt;P&gt;MONEY(AGGR(&lt;STRONG&gt;FirstSortedValue(BILLED_AMOUNT, -BILL_DATE)&lt;/STRONG&gt;,MATTER_ID))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 14:52:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521348#M685269</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T14:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521349#M685271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply Michael.&lt;/P&gt;&lt;P&gt;I've tried applying your suggestion and it's returning null.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:07:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521349#M685271</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T15:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521350#M685272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's why I used "maybe"...&amp;nbsp; Can you upload a small example of your application?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:10:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521350#M685272</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T15:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521351#M685274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunatly not.&lt;/P&gt;&lt;P&gt;Not being awkward, just wouldn't be feasible to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it can't be done with out, so be it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciated none the less.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:23:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521351#M685274</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T15:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521352#M685275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Last "blind" attempt.&amp;nbsp; Based on the fact you use sum(), I can assume that you have multiple BILLED_AMOUNT values in each date.&amp;nbsp; So:&lt;BR /&gt;MONEY(AGGR(SUM(if(BILL_DATE=DATE(AGGR(MAX(BILL_DATE), MATTER_ID)), BILLED_AMOUNT)), BILLED_AMOUNT))&lt;/P&gt;&lt;P&gt;It may depend on factors that I don't know.&amp;nbsp; Try to figure out from here...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:31:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521352#M685275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T15:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521353#M685277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Phill,&lt;/P&gt;&lt;P&gt;Please check out the attached file and see if it meets your requirement.&lt;/P&gt;&lt;P&gt;I put two text boxes. One of them calculates the max date for each MatterId and the other sums the BilledAmount corresponding to those max dates for each ID. &lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;AJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 15:54:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521353#M685277</guid>
      <dc:creator />
      <dc:date>2014-01-16T15:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521354#M685280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phill,&lt;/P&gt;&lt;P&gt;I understand what you're trying to do, as I have tried the same type of thing many times.&amp;nbsp; I think there is a general misunderstanding as to how set analysis functions in QlikView.&amp;nbsp; In general, SA seems to act like a sort of "where" clause for an expression, and therefore limits what is returned based on the SA expression.&amp;nbsp; In most cases this works for simple cases, but one thing to realize is that a SA expression evaluates at the environment level, not the row level.&amp;nbsp; The other major point to realize is that set analysis functions like a static user selection.&amp;nbsp; My suggestion is to try to think of SA in those terms: if you can do it with a selection, then it should work in a set expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On to your question:&lt;/P&gt;&lt;P&gt;I heavily recommend that you get max BILL_DATE and join it to the table containing MATTER_ID in the load script.&amp;nbsp; A second part of that is to create a 1/0 flag if the BILL_DATE = MAX_BILL_DATE, again, in the load script.&amp;nbsp; That way your UI expression becomes very simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Money(Sum({&amp;lt;MAX_BILL_DATE_FLAG={1}&amp;gt;} BILLED_AMOUNT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps and let me know if you need any clarification.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;I just noticed one other thing.&amp;nbsp; For your expression, you need another aggregate function on the outside of Aggr()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Money(SUM(Aggr(Sum(...),MATTER_ID)))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 16:27:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521354#M685280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T16:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis MAX(DATE) Not resolving</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521355#M685282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quite a practical explanation of the set analysis: "set analysis functions like a static user selection".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 16:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-MAX-DATE-Not-resolving/m-p/521355#M685282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-16T16:41:37Z</dc:date>
    </item>
  </channel>
</rss>

