<?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: incorrect calculated summary in pivot chart in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/incorrect-calculated-summary-in-pivot-chart/m-p/281648#M496084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe your problem is, that the expression for the total,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;count({&amp;lt;SKU = {"=sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion)&amp;gt;0"}&amp;gt;}&amp;nbsp; distinct SKU)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, uses a set expression that will not be evaluated in the context of the line / store, but for the complete chart (like all set expressions do).&lt;/P&gt;&lt;P&gt;You select a set of SKU where the sum of Depletion is larger than zero for the selected year, in your example, that are both SKU, black cherry and lemonade. &lt;/P&gt;&lt;P&gt;Your total expression will count the SKU for a given line, if you got a record for those SKU, but regardless if the sum of depletion is larger than zero. The two lines that seem not to match your expectations do have records, 0 / 0&amp;nbsp; resp -1 / 1, with a sum of zero, but as said, that doesn't matter here anymore.&lt;/P&gt;&lt;P&gt;The other stores that seem to count the zero sum for black cherry correctly just don't have any records, so the count will be zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, but how to correct for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use something like:&lt;/P&gt;&lt;P&gt;if (SecondaryDimensionality() &amp;gt;0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion)&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(if(sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion) &amp;gt;0, 1,0),[Store Number], SKU))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which will check the sum of depletion per line expression value (combination of Store number and SKU).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility might be to create a field in your Deletion_Fact table that combines Product_ID and %OutletKey and then create a set expression with the sum(...)&amp;gt;0 search string for that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is my modified sample.&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>Wed, 15 Feb 2012 12:59:27 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-02-15T12:59:27Z</dc:date>
    <item>
      <title>incorrect calculated summary in pivot chart</title>
      <link>https://community.qlik.com/t5/QlikView/incorrect-calculated-summary-in-pivot-chart/m-p/281647#M496083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This post is further to post &lt;A _jive_internal="true" href="https://community.qlik.com/message/191543#191543"&gt;http://community.qlik.com/message/191543#191543&lt;/A&gt; where I'm having difficulty with getting the proper count of skus/items on the summary rows on the far right of the pivot chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;There is a row of data (address 4808 E Bell rd) that has only one product but is showing 2 for count of sku's.&lt;/P&gt;&lt;P&gt;There is also a row of data (address 8001 E Mcdowell rd) that has no products but is showing 1 for count of sku's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone offer some insight into why this happens?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Qlikview image ALO error.jpg" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/11267_Qlikview+image+ALO+error.jpg" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also attached a sample qvw that also highlights this situation.&amp;nbsp; thanks so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 19:18:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/incorrect-calculated-summary-in-pivot-chart/m-p/281647#M496083</guid>
      <dc:creator />
      <dc:date>2012-02-14T19:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: incorrect calculated summary in pivot chart</title>
      <link>https://community.qlik.com/t5/QlikView/incorrect-calculated-summary-in-pivot-chart/m-p/281648#M496084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe your problem is, that the expression for the total,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;count({&amp;lt;SKU = {"=sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion)&amp;gt;0"}&amp;gt;}&amp;nbsp; distinct SKU)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, uses a set expression that will not be evaluated in the context of the line / store, but for the complete chart (like all set expressions do).&lt;/P&gt;&lt;P&gt;You select a set of SKU where the sum of Depletion is larger than zero for the selected year, in your example, that are both SKU, black cherry and lemonade. &lt;/P&gt;&lt;P&gt;Your total expression will count the SKU for a given line, if you got a record for those SKU, but regardless if the sum of depletion is larger than zero. The two lines that seem not to match your expectations do have records, 0 / 0&amp;nbsp; resp -1 / 1, with a sum of zero, but as said, that doesn't matter here anymore.&lt;/P&gt;&lt;P&gt;The other stores that seem to count the zero sum for black cherry correctly just don't have any records, so the count will be zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, but how to correct for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could use something like:&lt;/P&gt;&lt;P&gt;if (SecondaryDimensionality() &amp;gt;0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion)&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(if(sum({$&amp;lt;Year={$(=Only(Year))}&amp;gt;} Depletion) &amp;gt;0, 1,0),[Store Number], SKU))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which will check the sum of depletion per line expression value (combination of Store number and SKU).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility might be to create a field in your Deletion_Fact table that combines Product_ID and %OutletKey and then create a set expression with the sum(...)&amp;gt;0 search string for that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is my modified sample.&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>Wed, 15 Feb 2012 12:59:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/incorrect-calculated-summary-in-pivot-chart/m-p/281648#M496084</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-15T12:59:27Z</dc:date>
    </item>
  </channel>
</rss>

