<?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: Difference when using Max() or Min() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830395#M292259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;if I understood right, what you want to do is to get the min and max posting date for each customer, right ?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=Sum(If(Aggr( &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Max&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;(total &amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;Name&lt;/SPAN&gt;&amp;gt;[Posting Date]), Name) = [Posting Date], 1)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=Sum(If(Aggr( &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Min&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;(total &amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;Name&lt;/SPAN&gt;&amp;gt;[Posting Date]), Name) = [Posting Date], 1)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Apr 2015 16:20:41 GMT</pubDate>
    <dc:creator>ramoncova06</dc:creator>
    <dc:date>2015-04-14T16:20:41Z</dc:date>
    <item>
      <title>Difference when using Max() or Min()</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830393#M292257</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;For our sales team I want to display a chart that shows months as dimension and the counts of first as well as last orders of customers &lt;SPAN style="font-size: 13.3333330154419px;"&gt;as Y-values&lt;/SPAN&gt;. So first order means "new customer" and last order shows when the last order of a customer was placed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I figured out how to count the first orders: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;=Sum(If(Aggr( &lt;STRONG&gt;Min&lt;/STRONG&gt;([Posting Date]), Name) = [Posting Date], 1))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result: 39 New Customers spread across serveral months&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I try to do the same for last orders by exchanging Min for Max, the result ge&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Latest Orders:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=Sum(If(Aggr( &lt;STRONG&gt;Max&lt;/STRONG&gt;([Posting Date]), Name) = [Posting Date], 1))&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result: Only 12 Last Orders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logically thinking, every Cusomer should have a first and a last order. So both values should have the same sum in total. &lt;/P&gt;&lt;P&gt;I just don't get the mistake... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!!&lt;BR /&gt;Timm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;result table (diagram):&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 301px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="98"&gt;YearMonth&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="98"&gt;last order&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="105"&gt;first order&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD class="xl67" style="border-top: none;"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;&lt;STRONG&gt;39&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201208&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201209&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201212&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201302&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201304&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201305&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201307&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201308&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201309&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201310&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201312&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201401&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201403&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201405&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201407&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201409&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201410&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201412&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;201503&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl70" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 13:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830393#M292257</guid>
      <dc:creator />
      <dc:date>2015-04-14T13:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference when using Max() or Min()</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830394#M292258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think it will be the same result and your expression compared an aggregation directly with a field without aggregation which will be always return NULL if there isn't a unique value. I believe your expression should be more look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum(Aggr(sum({&amp;lt; [Posting Date] = {"$(=&lt;STRONG&gt;Max&lt;/STRONG&gt;([Posting Date]))"}&amp;gt;}1), Name, YearMonth)) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 16:15:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830394#M292258</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-04-14T16:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Difference when using Max() or Min()</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830395#M292259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;if I understood right, what you want to do is to get the min and max posting date for each customer, right ?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=Sum(If(Aggr( &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Max&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;(total &amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;Name&lt;/SPAN&gt;&amp;gt;[Posting Date]), Name) = [Posting Date], 1)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=Sum(If(Aggr( &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Min&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;(total &amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;Name&lt;/SPAN&gt;&amp;gt;[Posting Date]), Name) = [Posting Date], 1)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 16:20:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-when-using-Max-or-Min/m-p/830395#M292259</guid>
      <dc:creator>ramoncova06</dc:creator>
      <dc:date>2015-04-14T16:20:41Z</dc:date>
    </item>
  </channel>
</rss>

