<?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 Count Distinct based on values in 2 rows in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149804#M27925</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I have a situation where I cannot write an expression to get the desired result.&lt;/P&gt;&lt;P&gt;My data is as follows:&lt;/P&gt;&lt;P&gt;HU Current Status Stage Dt Loaded&lt;/P&gt;&lt;P&gt;5001 13 07/09/09 NULL&lt;/P&gt;&lt;P&gt;5001 22 NULL 07/11/09&lt;/P&gt;&lt;P&gt;5002 13 07/13/09 NULL&lt;/P&gt;&lt;P&gt;In the above data I want to count only the HU that has the status 13 populated and not the other one which has both 13 and 22.&lt;/P&gt;&lt;P&gt;I.e in above case No. of HU's currently in staging = 1 even though both the Hu's have the 13 status'es populated. My data is an automated feed and extracts multiple lines for the same HU.&lt;/P&gt;&lt;P&gt;Appreciate the help that anyone can provide on this.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jul 2009 22:14:50 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-20T22:14:50Z</dc:date>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149804#M27925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I have a situation where I cannot write an expression to get the desired result.&lt;/P&gt;&lt;P&gt;My data is as follows:&lt;/P&gt;&lt;P&gt;HU Current Status Stage Dt Loaded&lt;/P&gt;&lt;P&gt;5001 13 07/09/09 NULL&lt;/P&gt;&lt;P&gt;5001 22 NULL 07/11/09&lt;/P&gt;&lt;P&gt;5002 13 07/13/09 NULL&lt;/P&gt;&lt;P&gt;In the above data I want to count only the HU that has the status 13 populated and not the other one which has both 13 and 22.&lt;/P&gt;&lt;P&gt;I.e in above case No. of HU's currently in staging = 1 even though both the Hu's have the 13 status'es populated. My data is an automated feed and extracts multiple lines for the same HU.&lt;/P&gt;&lt;P&gt;Appreciate the help that anyone can provide on this.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 22:14:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149804#M27925</guid>
      <dc:creator />
      <dc:date>2009-07-20T22:14:50Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149805#M27926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you want to count only those HUs that have a Status 13 and nothing greater? Do you want to count only those HUs that don't have a loaded date?&lt;/P&gt;&lt;P&gt;For the first scenario:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Max(TOTAL &amp;lt;HU&amp;gt; [Current Status]) = 13&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;For the second:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;IsNull(Max(TOTAL &amp;lt;HU&amp;gt; Loaded))&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Depending on exactly how your data works some iteration of that should work. They key is the "TOTAL &amp;lt;HU&amp;gt;" inside the aggregation, which will get you the aggregation based on that field (HU).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 22:47:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149805#M27926</guid>
      <dc:creator />
      <dc:date>2009-07-20T22:47:05Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149806#M27927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miller.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response and I am trying your answer one in this scenario. It gives me an output of 0 when I am expecting 2 in thsi test file.&lt;/P&gt;&lt;P&gt;also I understand this is a differnt format of an if statement, how can I add another condition within the saqme expression. Lets say for eg. when&lt;/P&gt;&lt;P&gt;CS = 1 and SD &amp;lt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width:51pt;border-collapse:collapse;" width="68"&gt;&lt;COLGROUP&gt;&lt;COL style="width:51pt;mso-width-source:userset;mso-width-alt:2486;" width="68" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR style="height:15pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="width:51pt;height:15pt;background-color:transparent;border:#ece9d8;" width="68"&gt;7/15/2009&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 00:26:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149806#M27927</guid>
      <dc:creator />
      <dc:date>2009-07-21T00:26:00Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149807#M27928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forgot attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 00:31:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149807#M27928</guid>
      <dc:creator />
      <dc:date>2009-07-21T00:31:59Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149808#M27929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The statements I gave you work as chart expressions, but don't work in the text box. I'm not sure if it is possible to use them in a text box.&lt;/P&gt;&lt;P&gt;I've attached a sample that shows all HUs that have a max CS of 13 in a chart.&lt;/P&gt;&lt;P&gt;I'm not sure what you mean about adding a second condition question. You could add those conditions into the chart expression along with the Max CS expression. Maybe if you could give me some specifics on what you're looking to do here, I could give a more detailed answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 02:24:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149808#M27929</guid>
      <dc:creator />
      <dc:date>2009-07-21T02:24:51Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149809#M27930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way it is showing -1 for each of the registered value, I need to count from a set of HU's how many are in staging so wherever it is showing -1, i need to count that value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 05:39:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149809#M27930</guid>
      <dc:creator />
      <dc:date>2009-07-21T05:39:14Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149810#M27931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's simpler than that if I understand the question. Chart expression can be just max(CS)=13, and text box expression can be -sum(aggr(max(CS)=13,HU)).&lt;/P&gt;&lt;P&gt;The "max(CS)=13" part of both expressions is just a conditional, so add as many conditions as you want. However, the conditions you gave are not conditions at the summary level, but conditions at the detail level, so they'd have to go INSIDE of the max() expression. And in this specific case, they are incompatible with what you originally asked for, so I can't give you a combined example. Well, I could combine your date check with the max(CS)=13, so that you're looking for for a max(CS)=13 for dates &amp;lt; 7/15/2009. Something like max(if(SD&amp;lt;date('7/15/2009'),CS))=13.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 05:56:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149810#M27931</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-07-21T05:56:53Z</dc:date>
    </item>
    <item>
      <title>Count Distinct based on values in 2 rows</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149811#M27932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works perfectly for me.....:)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2009 22:11:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-based-on-values-in-2-rows/m-p/149811#M27932</guid>
      <dc:creator />
      <dc:date>2009-07-27T22:11:36Z</dc:date>
    </item>
  </channel>
</rss>

