<?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: Sum (If ( Min(    -   Error in Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835094#M293772</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally speaking, you can't use an aggregation function like Min() within another aggregation function like Sum().&lt;/P&gt;&lt;P&gt;You can probably use advanced aggregation, the aggr() function, to do achieve what you want, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum( Aggr( If(CreateDate&amp;gt;Min(InvoiceDate), Amount), Dimension1, Dimension2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace Dimension1, Dimension2 with appropriate field names (not necessarily 2, 1..n).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Think of it like&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;If(CreateDate&amp;gt;Min(InvoiceDate), Amount)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is an expression in a chart with dimensions Dimension1 and Dimension2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And since I said, generally speaking, you can indeed use something like above, but with the addition of the TOTAL qualifier:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;=Sum( &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;Min&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;( TOTAL &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;InvoiceDate&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;), Amount))&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: 13.3333330154419px;"&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: 13.3333330154419px;"&gt;Can't tell if this will fulfill your requirements without knowing more details of your model and context of the expression.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jul 2015 23:42:11 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2015-07-08T23:42:11Z</dc:date>
    <item>
      <title>Sum (If ( Min(    -   Error in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835093#M293771</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;I trying to make a sum of a field if some conditions are OK, but keep getting "Error in expression".&lt;/P&gt;&lt;P&gt;I've also tried using Set Analysis with same result&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Sum( &lt;SPAN style="color: #0000ff;"&gt;if&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;CreateDate&lt;/SPAN&gt; &amp;gt; &lt;SPAN style="color: #0000ff;"&gt;Min&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;InvoiceDate&lt;/SPAN&gt;), Amount)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;CreateDate and Amount is in one table - InvoiceDate is in another table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Can anyone explain why this is wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Nils&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 23:15:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835093#M293771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-08T23:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sum (If ( Min(    -   Error in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835094#M293772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally speaking, you can't use an aggregation function like Min() within another aggregation function like Sum().&lt;/P&gt;&lt;P&gt;You can probably use advanced aggregation, the aggr() function, to do achieve what you want, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum( Aggr( If(CreateDate&amp;gt;Min(InvoiceDate), Amount), Dimension1, Dimension2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace Dimension1, Dimension2 with appropriate field names (not necessarily 2, 1..n).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Think of it like&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;If(CreateDate&amp;gt;Min(InvoiceDate), Amount)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is an expression in a chart with dimensions Dimension1 and Dimension2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And since I said, generally speaking, you can indeed use something like above, but with the addition of the TOTAL qualifier:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;=Sum( &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;CreateDate&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;Min&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;( TOTAL &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333320617676px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;InvoiceDate&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;), Amount))&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: 13.3333330154419px;"&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: 13.3333330154419px;"&gt;Can't tell if this will fulfill your requirements without knowing more details of your model and context of the expression.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 23:42:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835094#M293772</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-08T23:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sum (If ( Min(    -   Error in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835095#M293773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you - that helped&lt;/P&gt;&lt;P&gt;I ended up with:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum&lt;SPAN style="font-size: 10pt;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;aggr&lt;/SPAN&gt; ( &lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;( &lt;SPAN style="color: #0000ff;"&gt;if&lt;/SPAN&gt; ( &lt;SPAN style="color: #800000;"&gt;CreateDate&lt;/SPAN&gt; = &lt;SPAN style="color: #800000;"&gt;InvoiceDate&lt;/SPAN&gt;, Amount)), &lt;SPAN style="color: #800000;"&gt;InvoiceDate&lt;/SPAN&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;Nils&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 04:22:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-Min-Error-in-Expression/m-p/835095#M293773</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-09T04:22:11Z</dc:date>
    </item>
  </channel>
</rss>

