<?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: Pivot Table - Sum of Two Fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249918#M868522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure I understand the logic behind your output table based on your input table. Would you be able to elaborate a little on how did you get from input to output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Nov 2016 08:56:31 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-11-30T08:56:31Z</dc:date>
    <item>
      <title>Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249917#M868521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a pivot table that sums up two different fields using, again, two different fields as dimension. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" width="64"&gt;Year1&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="64"&gt;Year2&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="64"&gt;Value1&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="64"&gt;Value2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.455885&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.544115&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.501606&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.498394&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.117714&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.882286&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.866523&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.133477&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.38556&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.61444&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.391917&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.608083&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;7&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.542071&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.457929&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="border-top: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;9&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.543696&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;0.456304&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;It will be easy to do this via SQL and load in another table that has a shape like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 128px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;Year&lt;/TD&gt;&lt;TD width="64"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;0.455885&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;1.045721&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;3&lt;/TD&gt;&lt;TD align="right"&gt;0.616108&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;4&lt;/TD&gt;&lt;TD align="right"&gt;1.748808&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;5&lt;/TD&gt;&lt;TD align="right"&gt;0.519037&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;6&lt;/TD&gt;&lt;TD align="right"&gt;1.006357&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;7&lt;/TD&gt;&lt;TD align="right"&gt;1.150154&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;8&lt;/TD&gt;&lt;TD align="right"&gt;1.001625&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;9&lt;/TD&gt;&lt;TD align="right"&gt;0.456304&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am loading in two very large tables already and loading another one would seriously compromise the performance of QV. Is there any way to set up the dimension and expression to achieve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My thoughts for the expression will be something like this:&lt;/P&gt;&lt;P&gt;sum(Value1) + sum(Value2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for the Calculated Dimension, I'm out of ideas. Hope you guys can help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Nathan&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/Pivot-Table-Sum-of-Two-Fields/m-p/1249917#M868521</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249918#M868522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure I understand the logic behind your output table based on your input table. Would you be able to elaborate a little on how did you get from input to output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 08:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249918#M868522</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-30T08:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249919#M868523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies for this as I created a sample using excel and the RAND() Function. I copied the wrong input table. So basically this is what happens:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Year 1 in the output table: We get 0.455885 (Corresponds the the first record since the Year1 field is equal to 1)&lt;/P&gt;&lt;P&gt;For Year 2 in the output table: We get 0.544115 + 0.501606 = 1.045721&amp;nbsp; (Corresponds to the Year2 field =2 and Year1 field =2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this clarifies everything.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 09:10:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249919#M868523</guid>
      <dc:creator />
      <dc:date>2016-11-30T09:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249920#M868524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean when years are same then you want to do Sum(Value1)+Sum(Value2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you describe more&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 09:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249920#M868524</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2016-11-30T09:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249921#M868525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be create an Island table for another field called Year and use that to show your new information on the front end. Please note, since you will be using Aggr() with island table, performance is going to be issue here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Year1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Year2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;FROM [&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2003" data-containertype="14" data-objectid="241470" data-objecttype="1" href="https://community.qlik.com/thread/241470"&gt;https://community.qlik.com/thread/241470&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Year:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD MinYear + IterNo() - 1 as Year&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;While MinYear + IterNo() - 1 &amp;lt;= MaxYear;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD RangeMin(Min(Year1), Min(Year2)) as MinYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeMax(Max(Year1), Max(Year2)) as MaxYear&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data model&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/145243_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(Sum(Aggr(If(Year = Year1, Value1), Year, Year1)), Sum(Aggr(If(Year = Year2, Value2), Year, Year2)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/145256_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 09:18:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249921#M868525</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-30T09:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Table - Sum of Two Fields</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249922#M868526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To illustrate:&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;For Year 1 in the output table: We get 0.455885 (Corresponds the the first record since the Year1 field is equal to 1)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;For Year 2 in the output table: We get 0.544115 + 0.501606 = 1.045721&amp;nbsp; (Corresponds to the Year2 field =2 and Year1 field =2) So we sum up Value2 of the first row since Year2 of the first row = 2 and the Value1 of the second row since the Year1 of the second row = 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 09:22:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Sum-of-Two-Fields/m-p/1249922#M868526</guid>
      <dc:creator />
      <dc:date>2016-11-30T09:22:36Z</dc:date>
    </item>
  </channel>
</rss>

