<?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 How can I formulate my count function. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483058#M1145979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I have a set of data which has a unique reference, how ever this data is liable to change.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;this is my current expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;COUNT({$ &amp;lt;&lt;SPAN style="color: #800000;"&gt;Area&lt;/SPAN&gt; ={'Foreign Body'}, &lt;SPAN style="color: #800000;"&gt;Sub_Area&lt;/SPAN&gt; ={'Bone'}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;Distinct&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;[SR_Ref]&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;This works ok unless the area and sub area data changes then it double counts the SR_Ref. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;There is a filedate field is unique to each SR-Ref line. which if i can count the line of data with the last filedate i believe it may work but i do not know how to formulate the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;thought may be i could use count(if ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Please hcan anyone help?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Aug 2013 07:58:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-08-12T07:58:36Z</dc:date>
    <item>
      <title>How can I formulate my count function.</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483058#M1145979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I have a set of data which has a unique reference, how ever this data is liable to change.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;this is my current expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;COUNT({$ &amp;lt;&lt;SPAN style="color: #800000;"&gt;Area&lt;/SPAN&gt; ={'Foreign Body'}, &lt;SPAN style="color: #800000;"&gt;Sub_Area&lt;/SPAN&gt; ={'Bone'}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;Distinct&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;[SR_Ref]&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;This works ok unless the area and sub area data changes then it double counts the SR_Ref. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;There is a filedate field is unique to each SR-Ref line. which if i can count the line of data with the last filedate i believe it may work but i do not know how to formulate the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;thought may be i could use count(if ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Please hcan anyone help?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 07:58:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483058#M1145979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-12T07:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I formulate my count function.</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483059#M1145980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could create an additional field in the script that flags the most recent record per SR_Ref.&lt;/P&gt;&lt;P&gt;There are multiple ways to do this, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TABLE1:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SR_Ref, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileDate,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Area,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sub_Area&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM ...;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LEFT JOIN (TABLE1) &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD SR_Ref,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(max(FileDate)) as FileDate, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 as Flag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RESIDENT TABLE1 GROUP BY SR_Ref;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or a MAPPING approach should also work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then add &lt;EM&gt;Flag = {1} &lt;/EM&gt;to your set expression field selections.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 09:26:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483059#M1145980</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-08-12T09:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I formulate my count function.</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483060#M1145981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Excellent this worked really well&lt;/P&gt;&lt;P&gt;Thanks &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 12:39:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-formulate-my-count-function/m-p/483060#M1145981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-11T12:39:11Z</dc:date>
    </item>
  </channel>
</rss>

