<?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 of a variable in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269756#M867059</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your variable contained an aggregation like sum or count and if you replaced the variable with it's content you will get an expression like: sum(sum(... if all the if-conditions and set analysis would be removed. This kind of aggregation isn't allowed respectively needs to extended or wrapped with an aggr-function: &lt;A href="https://community.qlik.com/qlik-blogpost/2967"&gt;AGGR...&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Dec 2016 11:50:31 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2016-12-02T11:50:31Z</dc:date>
    <item>
      <title>Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269754#M867057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to build a formula wich calculates the tax liability. The formula works fine only the part which is bold ($(vTax)) gives me trouble. I'm getting following error: nested aggregation not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Tax liability&lt;/P&gt;&lt;P&gt;if(ChType2= 'B' and left([Dim3Name$(vLang)2], 6) = '450001',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($(vTax) &amp;gt; 0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} &lt;STRONG&gt;$(vTax)&lt;/STRONG&gt;, '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00'),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} TXAmount * Factor2), '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00')),&lt;/P&gt;&lt;P&gt;//Others &lt;/P&gt;&lt;P&gt;Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} TXAmount * Factor2), '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i need a solution to get the sum from this variable in my calculation, does anyone have an idea how i can get the sum of a variable in set analysis???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269754#M867057</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269755#M867058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be as below: (Just added = )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;//Tax liability&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(ChType2= 'B' and left([Dim3Name$(vLang)2], 6) = '450001',&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($(vTax) &amp;gt; 0,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} &lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;$(=vTax)&lt;/STRONG&gt;, '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00'),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} TXAmount * Factor2), '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00')),&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;//Others&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} TXAmount * Factor2), '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00'))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2016 11:49:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269755#M867058</guid>
      <dc:creator>trdandamudi</dc:creator>
      <dc:date>2016-12-02T11:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269756#M867059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your variable contained an aggregation like sum or count and if you replaced the variable with it's content you will get an expression like: sum(sum(... if all the if-conditions and set analysis would be removed. This kind of aggregation isn't allowed respectively needs to extended or wrapped with an aggr-function: &lt;A href="https://community.qlik.com/qlik-blogpost/2967"&gt;AGGR...&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2016 11:50:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269756#M867059</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-12-02T11:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269757#M867060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But my variable doesn't contain an aggregation (like for example sum).&lt;/P&gt;&lt;P&gt;vTax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Num(&lt;/P&gt;&lt;P&gt;IF(($(eTaxCalculation))&amp;lt;($(vTaxlimit1)),0,&lt;/P&gt;&lt;P&gt;IF(($(vReducedTarif))=0,&lt;/P&gt;&lt;P&gt;IF(($(eTaxCalculation))&amp;gt;($(vTaxlimit2)),&lt;/P&gt;&lt;P&gt;IF(($(eTaxCalculation))&amp;gt;($(vTaxlimit3)),&lt;/P&gt;&lt;P&gt;IF(($(eTaxCalculation))&amp;gt;($(vTaxlimit4)),((($(eTaxCalculation))-($(vTaxlimit4)))*($(vTaxlevel1)))+($(vTaxamount1)),((($(eTaxCalculation))-($(vTaxlimit3))))*($(vTaxlevel2))+($(vTaxamount2))),&lt;/P&gt;&lt;P&gt;((($(eTaxCalculation))-$(vTaxlimit2))*($(vTaxlevel3))+($(vTaxamount3)))),&lt;/P&gt;&lt;P&gt;($(eTaxCalculation))*($(vTaxlevel4))),($(eTaxCalculation))*($(vTaxlevel1))))&lt;/P&gt;&lt;P&gt;, '#.##0,00')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second remark is when i wan't to use aggr() i need to use the dimensions in the formula, but i have tried it and i'm still getting an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My dimensions: 1. =If(ChType2 = 'B', Dual(Text([Dim1Name$(vLang)2]),Num(Order2)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. =If(ChType2 = 'B', [Dim2Name$(vLang)2])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. =If(ChType2 = 'B', [Dim3Name$(vLang)2])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i try it in a text object with following expression then i get the correct amount:&lt;/P&gt;&lt;P&gt;=Num(Sum({&amp;lt;ChType2={"B"}, BookingYear={"$(=Max(BookingYear))"}&amp;gt;} &lt;STRONG&gt;aggr($(vTax), BookingYear)&lt;/STRONG&gt;), '$(vCurrency) #.##0,00;$(vCurrency) -#.##0,00')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2016 12:05:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269757#M867060</guid>
      <dc:creator />
      <dc:date>2016-12-02T12:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269758#M867061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For this you would need to expand all variables and quite probably contained &lt;STRONG&gt;eTaxCalculation&lt;/STRONG&gt; or another variable there such an aggregation. To get an result with an aggr-function you need to specify real dimensions to it - it won't worked with calculated dimensions - in your case I would try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... &lt;STRONG&gt;aggr($(vTax), [Dim1Name$(vLang)2], [Dim2Name$(vLang)2], [Dim3Name$(vLang)2])&lt;/STRONG&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I fear if this don't work you will need a different approach with bigger changes to your variables, expressions and maybe the datamodel ... maybe starting with some simplifying to your expressions-approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2016 15:54:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269758#M867061</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-12-02T15:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269759#M867062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, i will try this, thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2016 07:26:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269759#M867062</guid>
      <dc:creator />
      <dc:date>2016-12-05T07:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269760#M867063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your answer. It took me this long to test this issue again. Your answer helped me to look in the right direction.&lt;BR /&gt;I used the AGGR function and after simplyfiyng my dimensions I got it working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 07:48:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-a-variable-in-set-analysis/m-p/1269760#M867063</guid>
      <dc:creator />
      <dc:date>2017-01-19T07:48:31Z</dc:date>
    </item>
  </channel>
</rss>

