<?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 Max Date, by 1st Dimension, in Pivot in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275906#M579778</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I think got it. It may not be the best way but it seems to be working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if([Invoice Date]=max(total &amp;lt;[Ship to Customer Number]&amp;gt;[Invoice Date]),sum([Sales Cases]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jan 2012 21:59:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-01-13T21:59:35Z</dc:date>
    <item>
      <title>Max Date, by 1st Dimension, in Pivot</title>
      <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275905#M579777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should be simple but I can't seem to get it. I need a pivot to only show the most recent invoice date, by customer. This set analysis expression doesn't do it:&amp;nbsp; &lt;SPAN style="font-family: Calibri, sans-serif; font-size: 11pt;"&gt;=sum({$&amp;lt;[InvoiceDate]={'$(=Max(Invoice_Date))'}&amp;gt;}[Sales Cases])&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Calibri, sans-serif; font-size: 11pt;"&gt;&lt;IMG alt="latestinvoice.jpg" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/10306_latestinvoice.jpg" width="450" /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 19:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275905#M579777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-13T19:14:09Z</dc:date>
    </item>
    <item>
      <title>Max Date, by 1st Dimension, in Pivot</title>
      <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275906#M579778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I think got it. It may not be the best way but it seems to be working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if([Invoice Date]=max(total &amp;lt;[Ship to Customer Number]&amp;gt;[Invoice Date]),sum([Sales Cases]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 21:59:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275906#M579778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-13T21:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date, by 1st Dimension, in Pivot</title>
      <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275907#M579779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Sum(If(Aggr(NODISTINCT Max([Invoice Date]), [Ship to Customer Number]) = [Invoice Date], Cases))&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It might worth testing how this expression performs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 22:41:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275907#M579779</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-01-13T22:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date, by 1st Dimension, in Pivot</title>
      <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275908#M579780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That seems to work in most cases but not all. Not sure why. The chart on the right is using your expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="latestinvoice1.jpg" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/10314_latestinvoice1.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 23:26:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275908#M579780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-13T23:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date, by 1st Dimension, in Pivot</title>
      <link>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275909#M579781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably because it needs another field [Ship To Customer Name] in the Aggr() function? Or may it be the NODISTINCT clause and account on purpose even when possible values for Max() are several in that aggregation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;CODE class="jive-code"&gt;Sum(If(Aggr(Max([Last Invoice Date]), [Ship to Customer Name], &lt;SPAN style="font-family: monospace; white-space: pre; background-color: #ffffff;"&gt;[Ship to Customer Name]&lt;/SPAN&gt;) = [Last Invoice Date], Cases))&lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What the function does is very similar to yours, but using two aggregation functions which, for example, will return a total if there is a total line. The Aggr() part returns the Max() value of Last Invoice Date for each value in Ship to Customer Name, and if the value corresponds to the max, then Sum the values in Cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A FirstSortedValue() instead of Aggr() combined with the Sum() &lt;A _jive_internal="true" href="https://community.qlik.com/thread/40356"&gt;will likely work&lt;/A&gt; as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jan 2012 23:34:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-Date-by-1st-Dimension-in-Pivot/m-p/275909#M579781</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-01-13T23:34:48Z</dc:date>
    </item>
  </channel>
</rss>

