<?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: Aggregation problem when using GetCurrentField in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-when-using-GetCurrentField/m-p/1089492#M362537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freddy,&lt;/P&gt;&lt;P&gt;I've had similar issues and found solutions, so I hope I can help.&lt;/P&gt;&lt;P&gt;Firstly, I don't see how you are using getCurrentField().&amp;nbsp; You also mention you are using a cyclic group so I suspect you may be using getCurrentField() to check which dimension the user is currently viewing.&amp;nbsp; If this is the case, then you will need to ensure that your AGGR statement is picking up the correct dimension and then grouping on this as the user changes the dimension.&amp;nbsp; EG:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14551916614625875" jivemacro_uid="_14551916614625875"&gt;
&lt;P&gt;aggr(count(transactions)), $(vCurrDim), custid)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the use of the &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;vCurrDim&lt;/SPAN&gt; variable within the expression to inject the correct field depending on the selected dimension.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The other issue I have had is getting the desired figure in the Total row or column.&amp;nbsp; Sometimes I have found that I have had to create this manually.&amp;nbsp; The trick there is to use a different expression for the Total compared to the rest of the column.&amp;nbsp; You can do this by using the &lt;SPAN style="font-family: 'courier new', courier;"&gt;RowNo()&lt;/SPAN&gt; function within an &lt;SPAN style="font-family: 'courier new', courier;"&gt;IF()&lt;/SPAN&gt; statement.&amp;nbsp; The Total row is always reported as Row number zero:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1455192001479110 jive_text_macro" jivemacro_uid="_1455192001479110" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;IF(RowNo()=0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,//--Some expression to produce a single Total&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,//--A second function to use for the rest of the column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I hope that helps you get to a solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Kind regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;George&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Feb 2016 12:00:59 GMT</pubDate>
    <dc:creator>gsbeaton</dc:creator>
    <dc:date>2016-02-11T12:00:59Z</dc:date>
    <item>
      <title>Aggregation problem when using GetCurrentField</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-when-using-GetCurrentField/m-p/1089491#M362536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to do an aggregated price variance analysis on cyclic dimensions. E.g. it should be possible to see this analysis on main group, product group, product line etc. In the example below there is one row where we do not have a dimension name for the main group of the granular data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I am struggling with getting the correct aggregation in the chart. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/114147_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Sales Price Variance 2 - the detailed lines show the correct value but incorrect aggregated sum.&lt;/P&gt;&lt;P&gt;In Sales Price Variance - the aggregation works fine but I am missing values from the Main group where dimension name is NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is the spreadsheet with the formulas used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope anyone can guide me on the correct path here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Freddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Feb 2016 10:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-when-using-GetCurrentField/m-p/1089491#M362536</guid>
      <dc:creator />
      <dc:date>2016-02-10T10:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem when using GetCurrentField</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem-when-using-GetCurrentField/m-p/1089492#M362537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Freddy,&lt;/P&gt;&lt;P&gt;I've had similar issues and found solutions, so I hope I can help.&lt;/P&gt;&lt;P&gt;Firstly, I don't see how you are using getCurrentField().&amp;nbsp; You also mention you are using a cyclic group so I suspect you may be using getCurrentField() to check which dimension the user is currently viewing.&amp;nbsp; If this is the case, then you will need to ensure that your AGGR statement is picking up the correct dimension and then grouping on this as the user changes the dimension.&amp;nbsp; EG:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14551916614625875" jivemacro_uid="_14551916614625875"&gt;
&lt;P&gt;aggr(count(transactions)), $(vCurrDim), custid)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the use of the &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;vCurrDim&lt;/SPAN&gt; variable within the expression to inject the correct field depending on the selected dimension.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The other issue I have had is getting the desired figure in the Total row or column.&amp;nbsp; Sometimes I have found that I have had to create this manually.&amp;nbsp; The trick there is to use a different expression for the Total compared to the rest of the column.&amp;nbsp; You can do this by using the &lt;SPAN style="font-family: 'courier new', courier;"&gt;RowNo()&lt;/SPAN&gt; function within an &lt;SPAN style="font-family: 'courier new', courier;"&gt;IF()&lt;/SPAN&gt; statement.&amp;nbsp; The Total row is always reported as Row number zero:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1455192001479110 jive_text_macro" jivemacro_uid="_1455192001479110" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;IF(RowNo()=0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,//--Some expression to produce a single Total&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,//--A second function to use for the rest of the column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I hope that helps you get to a solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Kind regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;George&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 12:00:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem-when-using-GetCurrentField/m-p/1089492#M362537</guid>
      <dc:creator>gsbeaton</dc:creator>
      <dc:date>2016-02-11T12:00:59Z</dc:date>
    </item>
  </channel>
</rss>

