<?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: Multiplying by a fix value located on a Pivot table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398782#M568986</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can have multiple records per combination of your aggr() dimension values for field Amount, so you need to aggregate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(rowno()=0,&lt;/P&gt;&lt;P&gt;SUM(AGGR((&lt;STRONG&gt;sum(Amount)&lt;/STRONG&gt;-(Value*max(total&amp;lt;Category&amp;gt;aggr(SUM(Amount),Category,Class,Code))/1000))*Price,Type,Category,Class,Code))&lt;/P&gt;&lt;P&gt;,Column(6)*Column(7))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 03 Nov 2012 19:16:08 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-11-03T19:16:08Z</dc:date>
    <item>
      <title>Multiplying by a fix value located on a Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398779#M568983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I have a headache with this pivot table, so I will appreciate your help.&lt;/P&gt;&lt;P&gt;The correct value for Category “A” must be 21600 and for Category “B” must be 29700.&lt;/P&gt;&lt;P&gt;You are thinking that the solution is a simple aggregate function on the total. Believe me. But there is something else.&lt;/P&gt;&lt;P&gt;Two important things:&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;The data are ordered “desc” considering the column named “Value”&lt;/LI&gt;&lt;LI&gt;The Column named “Calculation1” has the complexity, because it takes the top value of the column “Amount” to multiply on its calculation.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Everything looks normal, until the sum on the subtotal of the column Profit is required. &lt;/P&gt;&lt;P&gt;The reason is simple: &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; The column calculation1 has the expression:&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; =Value*TOP(SUM(Amount))/1000&lt;/P&gt;&lt;P&gt;The TOP function was the only way that I found to select the maximum value of the column “Amount” according to the Dimension named “Class”.&lt;/P&gt;&lt;P&gt;But the TOP function doesn’t work properly on the column named “Profit” with the expression:&lt;/P&gt;&lt;P&gt;=if(rowno()=0,SUM(AGGR((Amount-(Value*TOP(SUM(Amount))/1000))*Price,Type,Category,Class,Code)),Column(6)*Column(7))&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;I try to develop a script to work with all the columns on a table without calculations. But when comes the TOP() function, I don’t know how to deal with a fix value on the script.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I will appreciate a solution on the pivot table and another via script.&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Nov 2012 15:34:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398779#M568983</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-03T15:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying by a fix value located on a Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398780#M568984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dimension values in your advanced aggregation will be sorted by load order, not by the sort order you define in the chart. So using top() function here will not return a correct result in general. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can ask for the maximum value, since this is what you want to get anyway,right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(rowno()=0,&lt;/P&gt;&lt;P&gt;SUM(AGGR((Amount-(Value*max(total&amp;lt;Category&amp;gt;aggr(SUM(Amount),Category,Class,Code))/1000))*Price,Type,Category,Class,Code))&lt;/P&gt;&lt;P&gt;,Column(6)*Column(7))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can probably simplify this expression a bit further, but this one should return a correct result now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Nov 2012 15:49:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398780#M568984</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-11-03T15:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying by a fix value located on a Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398781#M568985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stefan,&lt;/P&gt;&lt;P&gt;Thanks for your fast reply. It was really close.&amp;nbsp; Yes, you are right: I am looking for the maximum value on the field “Amount” regarding to the field “Class”. I tried your expression. The result for “Category B” fits correctly, but for some estrange reason for “Category A” don’t.&lt;/P&gt;&lt;P&gt;The correct sum for ”Category A” must be 21600 but it returns 21350. &lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;Thanks for any idea.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Nov 2012 18:41:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398781#M568985</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-03T18:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying by a fix value located on a Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398782#M568986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can have multiple records per combination of your aggr() dimension values for field Amount, so you need to aggregate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(rowno()=0,&lt;/P&gt;&lt;P&gt;SUM(AGGR((&lt;STRONG&gt;sum(Amount)&lt;/STRONG&gt;-(Value*max(total&amp;lt;Category&amp;gt;aggr(SUM(Amount),Category,Class,Code))/1000))*Price,Type,Category,Class,Code))&lt;/P&gt;&lt;P&gt;,Column(6)*Column(7))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Nov 2012 19:16:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398782#M568986</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-11-03T19:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Multiplying by a fix value located on a Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398783#M568987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Nov 2012 21:21:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiplying-by-a-fix-value-located-on-a-Pivot-table/m-p/398783#M568987</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-03T21:21:16Z</dc:date>
    </item>
  </channel>
</rss>

