<?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 Adding row with averages to pivot table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186477#M50547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can do it using advanced aggregation. If you modify your Expression along the following lines, and request subtotals for the Day, you should get youat you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;avg( aggr( sum(Quantity), Plant, Date))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You may also need to condition your formula on the level of detail - only use it when you are showing totals for the Plant. In this case, you'll need to use function Dimensionality():&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if(Dimensionality() = 1, // Total by the first dimension&lt;BR /&gt; avg( aggr( sum(Quantity), Plant, Date)),&lt;BR /&gt; sum(Quantity)&lt;BR /&gt;)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Sep 2009 00:29:52 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2009-09-15T00:29:52Z</dc:date>
    <item>
      <title>Adding row with averages to pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186476#M50546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table that shows the total quantity for the last ten days for each plant. Across the top is the plant, along the side is the 10 days. Each value is the total for that day.&lt;/P&gt;&lt;P&gt;At the end I would like to have a row that shows the avg for the last 10 days. Is something like this possible?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 00:02:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186476#M50546</guid>
      <dc:creator>sicilianif</dc:creator>
      <dc:date>2009-09-15T00:02:41Z</dc:date>
    </item>
    <item>
      <title>Adding row with averages to pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186477#M50547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can do it using advanced aggregation. If you modify your Expression along the following lines, and request subtotals for the Day, you should get youat you are looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;avg( aggr( sum(Quantity), Plant, Date))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You may also need to condition your formula on the level of detail - only use it when you are showing totals for the Plant. In this case, you'll need to use function Dimensionality():&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if(Dimensionality() = 1, // Total by the first dimension&lt;BR /&gt; avg( aggr( sum(Quantity), Plant, Date)),&lt;BR /&gt; sum(Quantity)&lt;BR /&gt;)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 00:29:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186477#M50547</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-09-15T00:29:52Z</dc:date>
    </item>
    <item>
      <title>Adding row with averages to pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186478#M50548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This might be a little simpler - although AGGR is a great function to use if you need correct sum of rows, etc. in a pivot table.&lt;/P&gt;&lt;P&gt;If you set your Sales calculation as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Sum(Sales)/Count(Distinct Plant)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then it will just calculate the correct sum on each Plant row (because the Count of Plant = 1) but will give you an average at the total.&lt;/P&gt;&lt;P&gt;Try it and see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 00:37:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186478#M50548</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2009-09-15T00:37:28Z</dc:date>
    </item>
    <item>
      <title>Adding row with averages to pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186479#M50549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That worked. I had started down that path before, but I did not include both dimensions in the aggr statement, which caused me not to get the results that I was looking for.&lt;/P&gt;&lt;P&gt;I did not have to add the condition.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 00:39:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186479#M50549</guid>
      <dc:creator>sicilianif</dc:creator>
      <dc:date>2009-09-15T00:39:59Z</dc:date>
    </item>
    <item>
      <title>Adding row with averages to pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186480#M50550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stephen,&lt;/P&gt;&lt;P&gt;That did not work because the plant is not the row dimension. It is the column.&lt;/P&gt;&lt;P&gt;I tried the same logic with the Date, but could not get it working. I believe it has something to do with the Set Analysis I am doing in the sum.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2009 00:51:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-row-with-averages-to-pivot-table/m-p/186480#M50550</guid>
      <dc:creator>sicilianif</dc:creator>
      <dc:date>2009-09-15T00:51:41Z</dc:date>
    </item>
  </channel>
</rss>

