<?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: Problem with count returning wrong value using alternate states in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789929#M1035512</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Elena for the answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, it should indeed not return the same result if the selections for the two states are different. Forgot to mention that the selection is over the total data set in the both states.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2015 15:08:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-01-29T15:08:54Z</dc:date>
    <item>
      <title>Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789926#M1035509</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;Should start with saying that Im kinda new to Qlikview.&lt;/P&gt;&lt;P&gt;I have som problem with using the count() function on two alternate states.&lt;/P&gt;&lt;P&gt;The following code is used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(1) count({Group_left * Group_right}distinct TP_ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(2) count({Group_left} distinct TP_ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where &lt;STRONG&gt;Group_left&lt;/STRONG&gt; and &lt;STRONG&gt;Group_right&lt;/STRONG&gt; are alternate states of the same data.&lt;/P&gt;&lt;P&gt;My problem is that &lt;STRONG&gt;(1)&lt;/STRONG&gt; and &lt;STRONG&gt;(2)&lt;/STRONG&gt; returns different values, &lt;STRONG&gt;100014&lt;/STRONG&gt; and &lt;STRONG&gt;100017&lt;/STRONG&gt; respectively, when they should return the same. In my alternate states I have got one table, customer, which contains ID and some other columns. The customer IDs are loaded from two different tables in a SQL database as follows,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Customer:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Kund_Id] AS [ID],&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; FROM &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; [customer];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Recipient:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[RecipientId] as [ID]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; font-size: 10pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Recipient];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its this step, which adds new IDs from the Recipient table, that is the source of the problem in my opinion (since three IDs are unique from the Recipients table). Is there any possible workaround this problem that I have?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Mattias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 12:36:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789926#M1035509</guid>
      <dc:creator />
      <dc:date>2015-01-29T12:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789927#M1035510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mattias,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;are you sure that 1) and 2) should give the same result?&lt;/P&gt;&lt;P&gt;1) is an intersection, so it seems correct that value is smaller than 2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Elena&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 14:50:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789927#M1035510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-29T14:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789928#M1035511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the value of &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count({Group_right} distinct TP_ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 15:03:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789928#M1035511</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-01-29T15:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789929#M1035512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Elena for the answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, it should indeed not return the same result if the selections for the two states are different. Forgot to mention that the selection is over the total data set in the both states.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 15:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789929#M1035512</guid>
      <dc:creator />
      <dc:date>2015-01-29T15:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789930#M1035513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its the same as for &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count({Group_left} distinct TP_ID)&lt;/STRONG&gt;, 100017.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 15:44:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789930#M1035513</guid>
      <dc:creator />
      <dc:date>2015-01-29T15:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789931#M1035514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you already seen this post?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/413697#413697"&gt;http://community.qlik.com/message/413697#413697&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 15:49:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789931#M1035514</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-29T15:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with count returning wrong value using alternate states</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789932#M1035515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that helped!&lt;/P&gt;&lt;P&gt;With the following,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count({Group_left &amp;lt;TP_ID=P({Group_right} TP_ID)&amp;gt;} TP_ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;it returns the expected count value of 100017.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 16:15:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-count-returning-wrong-value-using-alternate-states/m-p/789932#M1035515</guid>
      <dc:creator />
      <dc:date>2015-01-29T16:15:32Z</dc:date>
    </item>
  </channel>
</rss>

