<?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 Aggregation Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-Expression/m-p/205077#M61726</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks&lt;/P&gt;&lt;P&gt;First, apologies for the formatting on the above, difficult getting that stuff right.&lt;/P&gt;&lt;P&gt;Anyway, I figured it out, it was nothing to do with the formula anyway, the data model behind it was causing the issue by returning NULL values for some transactions at certain currencies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jan 2010 12:38:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-01-08T12:38:20Z</dc:date>
    <item>
      <title>Aggregation Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Expression/m-p/205076#M61725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Folks&lt;/P&gt;&lt;P&gt;I have a problem with the Aggr function that for some reason returns a result of zero.&lt;/P&gt;&lt;P&gt;The following formula returns results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;=Num(&lt;BR /&gt;(&lt;BR /&gt; (&lt;BR /&gt; // FMV Movement at the Investment Currency&lt;BR /&gt; (&lt;BR /&gt; Sum ( _rFMV )&lt;BR /&gt; *&lt;BR /&gt; Max(FX_fromUSD_ToInvCcy_RepDate)&lt;BR /&gt; )&lt;BR /&gt; -&lt;BR /&gt; (&lt;BR /&gt; Sum({$&amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"}&amp;gt;} _rFMV )&lt;BR /&gt; *&lt;BR /&gt; Max({$&amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"}&amp;gt;} FX_fromUSD_ToInvCcy_RepDate )&lt;BR /&gt; )&lt;BR /&gt; +&lt;BR /&gt; (&lt;BR /&gt; // Current Period Distributions at Investment Currency&lt;BR /&gt; Sum ( _iDist )&lt;BR /&gt; -&lt;BR /&gt; // Prior Period Distributions at Investment Currency&lt;BR /&gt; Sum ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } _iDist )&lt;BR /&gt; )&lt;BR /&gt; -&lt;BR /&gt; (&lt;BR /&gt; // Current Period Cost at Investment Currency&lt;BR /&gt; Sum ( _iCost )&lt;BR /&gt; -&lt;BR /&gt; // Prior Period Cost at Investment Currency&lt;BR /&gt; Sum ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } _iCost )&lt;BR /&gt; )&lt;BR /&gt; )&lt;BR /&gt; //Prior Period FX Rate at the Investment Currency&lt;BR /&gt; /&lt;BR /&gt; Max ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } FX_fromUSD_ToInvCcy_RepDate )&lt;BR /&gt; )&lt;BR /&gt;/vDivisor&lt;BR /&gt; ,vNumberFormat&lt;BR /&gt; )&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem though, is that I need to aggregate this over a currency field (the only dimension I have in the table is RG_Investment, I also need to aggregate over IT_InvCcy) so I thought the following would work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;&lt;BR /&gt;=Num(&lt;BR /&gt;// Sum(&lt;BR /&gt;// Aggr(&lt;BR /&gt; (&lt;BR /&gt; (&lt;BR /&gt; // FMV Movement at the Investment Currency&lt;BR /&gt; (&lt;BR /&gt; Sum ( _rFMV )&lt;BR /&gt; *&lt;BR /&gt; Max(FX_fromUSD_ToInvCcy_RepDate)&lt;BR /&gt; )&lt;BR /&gt; -&lt;BR /&gt; (&lt;BR /&gt; Sum({$&amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"}&amp;gt;} _rFMV )&lt;BR /&gt; *&lt;BR /&gt; Max({$&amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"}&amp;gt;} FX_fromUSD_ToInvCcy_RepDate )&lt;BR /&gt; )&lt;BR /&gt; +&lt;BR /&gt; (&lt;BR /&gt; // Current Period Distributions at Investment Currency&lt;BR /&gt; Sum ( _iDist )&lt;BR /&gt; -&lt;BR /&gt; // Prior Period Distributions at Investment Currency&lt;BR /&gt; Sum ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } _iDist )&lt;BR /&gt; )&lt;BR /&gt; -&lt;BR /&gt; (&lt;BR /&gt; // Current Period Cost at Investment Currency&lt;BR /&gt; Sum ( _iCost )&lt;BR /&gt; -&lt;BR /&gt; // Prior Period Cost at Investment Currency&lt;BR /&gt; Sum ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } _iCost )&lt;BR /&gt; )&lt;BR /&gt; )&lt;BR /&gt; //Prior Period FX Rate at the Investment Currency&lt;BR /&gt; /&lt;BR /&gt; Max ( { $ &amp;lt;DT_ReportDate={"$(vCompDate)"},DT_ComparisonDate={"*"} &amp;gt; } FX_fromUSD_ToInvCcy_RepDate )&lt;BR /&gt; )&lt;BR /&gt; ,RG_Investment,IT_InvCcy&lt;BR /&gt; )&lt;BR /&gt; )&lt;BR /&gt; /vDivisor&lt;BR /&gt; ,vNumberFormat&lt;BR /&gt; )&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This just returns results of zero, and I'm completely lost with it.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes:&lt;/P&gt;&lt;P&gt;vDivisor is simply a unit divider that is set to either 1, 1000 or 1000000&lt;/P&gt;&lt;P&gt;vNumberFormat is the decimal formatting, currently set to #,##0;(#,##0);-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated as I'm rapidly losing the will to live.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jan 2010 10:13:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Expression/m-p/205076#M61725</guid>
      <dc:creator />
      <dc:date>2010-01-08T10:13:54Z</dc:date>
    </item>
    <item>
      <title>Aggregation Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Expression/m-p/205077#M61726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks&lt;/P&gt;&lt;P&gt;First, apologies for the formatting on the above, difficult getting that stuff right.&lt;/P&gt;&lt;P&gt;Anyway, I figured it out, it was nothing to do with the formula anyway, the data model behind it was causing the issue by returning NULL values for some transactions at certain currencies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jan 2010 12:38:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Expression/m-p/205077#M61726</guid>
      <dc:creator />
      <dc:date>2010-01-08T12:38:20Z</dc:date>
    </item>
  </channel>
</rss>

