<?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: Chart count expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413828#M1165032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replying!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to make sure we're on the same page: CustomerID appears several times as some customers have several contracts. Different customers in some case have the same ContractID as their one contract or as one of their many contracts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might be missing the point, but I don't see how a CustomerFlag would help as I need to count every active contract. Contracts are considered active if their startdate is today or in the past and the enddate is in the future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Oct 2012 11:32:35 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-15T11:32:35Z</dc:date>
    <item>
      <title>Chart count expression</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413826#M1165030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;CustomerID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ContractID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;StartDate&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;EndDate&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;135&lt;/TD&gt;&lt;TD&gt;02.05.2010 00:00:00&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;654&lt;/TD&gt;&lt;TD&gt;12.12.2000 00:00:00&lt;/TD&gt;&lt;TD&gt;01.01.2012 00:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;317&lt;/TD&gt;&lt;TD&gt;31.01.2007 00:00:00&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;890&lt;/TD&gt;&lt;TD&gt;10.06.2002 00:00:00&lt;/TD&gt;&lt;TD&gt;NULL&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've set up a gauge chart with the following expression: Count ({1} DISTINCT CustomerID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The chart displays the total count of CustomerID regardless of selection, but i need to filter some more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A CustomerID can have multiple ContractIDs and also I need to verify that the EndDate is after todays date or null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having a hard time figuring out the correct syntax to use in the Edit Expression window. A little help would be nice &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 09:34:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413826#M1165030</guid>
      <dc:creator />
      <dc:date>2012-10-15T09:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Chart count expression</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413827#M1165031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Syntax should be something along the lines of:&lt;/P&gt;&lt;P&gt;=count({1&amp;lt;EndDate={'&amp;gt;$(=Now(0))'}&amp;gt;} Distinct CustomerID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, it would be nicer to strip the time part of the dates if you are only concerned with the day and use the Today() function to match your EndDates to.&lt;/P&gt;&lt;P&gt;You might also want to create a CustomerFlag or something if you have a separate table with your customers with the value 1 for each unique customer. This way you can use Sum(CustomerFlag) which is a lot more responsive than using Count(Distinct CustomerID)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 10:11:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413827#M1165031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-15T10:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Chart count expression</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413828#M1165032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replying!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to make sure we're on the same page: CustomerID appears several times as some customers have several contracts. Different customers in some case have the same ContractID as their one contract or as one of their many contracts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might be missing the point, but I don't see how a CustomerFlag would help as I need to count every active contract. Contracts are considered active if their startdate is today or in the past and the enddate is in the future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 11:32:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413828#M1165032</guid>
      <dc:creator />
      <dc:date>2012-10-15T11:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Chart count expression</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413829#M1165033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would set the CustomerFlag during the load script to 1 for each contract without an end date and for each contract with end dates &amp;gt; today.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Contracts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(IsNull(EndDate) Or EndDate &amp;gt; Today(1), 1, 0) As CustomerFlag&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then (after a reload of course!) in your expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count({&amp;lt;CustomerFlag = {1}&amp;gt;} Distinct CustomerID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 11:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413829#M1165033</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2012-10-15T11:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Chart count expression</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413830#M1165034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! That's what I needed&amp;nbsp; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2012 12:30:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-count-expression/m-p/413830#M1165034</guid>
      <dc:creator />
      <dc:date>2012-10-15T12:30:14Z</dc:date>
    </item>
  </channel>
</rss>

