<?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 Strange Issue on Calculation Dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310812#M114766</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run into the following issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my data table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load * Inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Category,MemberId&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,3&lt;/P&gt;&lt;P&gt;B,1&lt;/P&gt;&lt;P&gt;B,2&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use pivot table to show the them, it looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Category,&amp;nbsp; Class,&amp;nbsp; Member count, total Member count based on Category&lt;/P&gt;&lt;P&gt;A,&amp;nbsp; 3,&amp;nbsp;&amp;nbsp; 2,&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;A,&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;B,&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two dimensions: Category and Class, Class is a calculation dimension: that is to class sales quantity group: like 1,2,3...&lt;/P&gt;&lt;P&gt;In this sample: there 2 guys(MemberId 1 and 2)&amp;nbsp; have bought 3 products on A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for measure, Member count is count(distinct MemberId)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my question is on total Member count based on Category, it should be the total member based on category, for category, it shoule be 3, I use the expression : count( distinct TOTAL&amp;lt;Category&amp;gt;&amp;nbsp; MemberId). But as you have seen, it is 2 and 1 for Category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to solve it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I did not make myself clear, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2011 01:58:22 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-05-19T01:58:22Z</dc:date>
    <item>
      <title>Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310812#M114766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run into the following issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is my data table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load * Inline&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;Category,MemberId&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,3&lt;/P&gt;&lt;P&gt;B,1&lt;/P&gt;&lt;P&gt;B,2&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use pivot table to show the them, it looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Category,&amp;nbsp; Class,&amp;nbsp; Member count, total Member count based on Category&lt;/P&gt;&lt;P&gt;A,&amp;nbsp; 3,&amp;nbsp;&amp;nbsp; 2,&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;A,&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;B,&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two dimensions: Category and Class, Class is a calculation dimension: that is to class sales quantity group: like 1,2,3...&lt;/P&gt;&lt;P&gt;In this sample: there 2 guys(MemberId 1 and 2)&amp;nbsp; have bought 3 products on A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for measure, Member count is count(distinct MemberId)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now my question is on total Member count based on Category, it should be the total member based on category, for category, it shoule be 3, I use the expression : count( distinct TOTAL&amp;lt;Category&amp;gt;&amp;nbsp; MemberId). But as you have seen, it is 2 and 1 for Category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to solve it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I did not make myself clear, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 01:58:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310812#M114766</guid>
      <dc:creator />
      <dc:date>2011-05-19T01:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310813#M114767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Please can you upload a QV document with sample data? Also demonstrating the issue in more detail...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Many thanks - DV&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 08:22:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310813#M114767</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-05-19T08:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310814#M114768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Please refer to the attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 09:42:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310814#M114768</guid>
      <dc:creator />
      <dc:date>2011-05-19T09:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310815#M114769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;I would generally use Set Analysis for this kind of issues (especially for pivot table). The expression you are using is actually counting the distinct values for each dimension. However, we wanted the total distinct count for all the data... isn't it? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;In this scenario, I would use &lt;SPAN style="color: #003366;"&gt;&lt;STRONG&gt;Dollar Sign Expansion&lt;/STRONG&gt;&lt;/SPAN&gt; with a &lt;SPAN style="color: #003366;"&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/SPAN&gt;. Create a variable with the same syntax you had provided...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;vCount&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;=count( distinct TOTAL&amp;lt;Category&amp;gt;&amp;nbsp; MemberId)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;*Please note: It is very important to include &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;"=" &lt;/STRONG&gt;&lt;/SPAN&gt;symbol at the beginning, while creating the variable. If you don't include &lt;STRONG style="color: #ff0000;"&gt;"="&lt;/STRONG&gt; then QV expands the variable and evaluates it for each dimension. Which we don't want... so adding the&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt; "=" &lt;/STRONG&gt;&lt;/SPAN&gt;at the beginning makes the difference. And now QV evaluates the variable only once and it fetches the value instead of evaluating the variable.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Then I would use this variable in the pivot table and it shows &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt; as total distinct count instead of counting for each dimension. Using dollar sign expansion to trick QV &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Please use this expression in the pivot table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG style="font-family: trebuchet ms,geneva;"&gt;$(vCount)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;I am also attaching the example for your reference.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Please let me know if you need further help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: trebuchet ms,geneva;"&gt;Cheers - &lt;STRONG&gt;DV&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 15:33:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310815#M114769</guid>
      <dc:creator>IAMDV</dc:creator>
      <dc:date>2011-05-19T15:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310816#M114770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for you reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Category A, the total members is 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But for B, the total shoule be 2 not 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to handle it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2011 01:40:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310816#M114770</guid>
      <dc:creator />
      <dc:date>2011-05-20T01:40:00Z</dc:date>
    </item>
    <item>
      <title>Strange Issue on Calculation Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310817#M114771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi try this expression and let me know its working or not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rangesum(top((Aggr(count(distinct&amp;nbsp; MemberId),Category)),1,count(distinct total MemberId)))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2011 11:10:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-Issue-on-Calculation-Dimension/m-p/310817#M114771</guid>
      <dc:creator>qliksus</dc:creator>
      <dc:date>2011-05-20T11:10:45Z</dc:date>
    </item>
  </channel>
</rss>

