<?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 Expression help, count the number of people whose substring count =1 or 2 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771283#M1045737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I put this together to count the total number of interactions for a group of people by client and it looks to be giving correct counts.&amp;nbsp; In the sub-tasks field, people have a CT-# notation added to their record on the same line for each interaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data looks like:&lt;/P&gt;&lt;P&gt;Client Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExternalID&amp;nbsp;&amp;nbsp; Sub- Tasks&lt;/P&gt;&lt;P&gt;AcmeAnvils&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CT-123, CT-456&lt;/P&gt;&lt;P&gt;AcmeAnvils&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CT-987&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and my expression to count the interactions is:&lt;/P&gt;&lt;P&gt;SUM(substringcount(aggr([Sub-Tasks], ExternalID, [Client Name]), 'CT-'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer it gives is 3 and it is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'm trying to make an expression that counts 'the number of people who had 1-2 interactions'.&amp;nbsp; In this case, the desired answer is 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried wrapping the above with count(if(...=1),ExternalID) + count(if(...=2),ExternalID) and the like, but am not getting to any correct answers.&amp;nbsp; (I actually have another column for people with 3-4 interactions and one for people with 5+, but they will be the same concept.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help, please.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2014 21:53:20 GMT</pubDate>
    <dc:creator>stevelord</dc:creator>
    <dc:date>2014-12-03T21:53:20Z</dc:date>
    <item>
      <title>Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771283#M1045737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I put this together to count the total number of interactions for a group of people by client and it looks to be giving correct counts.&amp;nbsp; In the sub-tasks field, people have a CT-# notation added to their record on the same line for each interaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data looks like:&lt;/P&gt;&lt;P&gt;Client Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExternalID&amp;nbsp;&amp;nbsp; Sub- Tasks&lt;/P&gt;&lt;P&gt;AcmeAnvils&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CT-123, CT-456&lt;/P&gt;&lt;P&gt;AcmeAnvils&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CT-987&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and my expression to count the interactions is:&lt;/P&gt;&lt;P&gt;SUM(substringcount(aggr([Sub-Tasks], ExternalID, [Client Name]), 'CT-'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer it gives is 3 and it is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'm trying to make an expression that counts 'the number of people who had 1-2 interactions'.&amp;nbsp; In this case, the desired answer is 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried wrapping the above with count(if(...=1),ExternalID) + count(if(...=2),ExternalID) and the like, but am not getting to any correct answers.&amp;nbsp; (I actually have another column for people with 3-4 interactions and one for people with 5+, but they will be the same concept.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help, please.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;-Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 21:53:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771283#M1045737</guid>
      <dc:creator>stevelord</dc:creator>
      <dc:date>2014-12-03T21:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771284#M1045738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(&lt;/P&gt;&lt;P&gt;if(aggr(substringcount([Sub- Tasks],&amp;nbsp; 'CT-'), [Client Name], ExternalID)=1,1,&lt;/P&gt;&lt;P&gt;if(aggr(substringcount([Sub- Tasks],&amp;nbsp; 'CT-'), [Client Name], ExternalID)=2,1)&lt;/P&gt;&lt;P&gt;))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:04:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771284#M1045738</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-12-03T22:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771285#M1045739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, the desired result in the dummy data was 2.&amp;nbsp; The desired result in my actual data was 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your answer was correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also modified it for 3 and 4 contacts and &amp;gt;4 contacts for the other two columns, and got the desired results in those buckets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:37:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771285#M1045739</guid>
      <dc:creator>stevelord</dc:creator>
      <dc:date>2014-12-03T22:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771286#M1045740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You CAN do this in your application but it would be much easier to do it in the script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just load subfield([&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Sub- Tasks],',') as [&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Sub- Tasks]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can keep this in its own dimension and then add a field "number of subtasks" to you fact. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;letft join(Facts)&lt;/P&gt;&lt;P&gt;load &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Client Name]&lt;/SPAN&gt;, count(distinct [Sub-Tasks]) as [Sub-Tasks Count] resident SubTasks group by [&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Client Name]&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;Then you can eitehr use [Sub-Tasks Count] as a dimension in a chart with the expression Count(distinct [Client Name])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if you want to use a text box to display the number of clients with 2 sub-tasks you use:&lt;BR /&gt;Count({&amp;lt;{Sub-Tasks Count]={2}&amp;gt;} distinct [Client Name])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:40:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771286#M1045740</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-12-03T22:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771287#M1045741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Possibly easier, but the other solution is already done now which makes it quicker if I start now. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do see how your idea would enable us to filter our selections based on who had how many interactions.&amp;nbsp; If end users begin requesting this, I will circle back with the script-based solution to create the field with the counts in it.&amp;nbsp; (Right now I think they're just trying to get out from under too many hours toiling through massive excel exports to count the things. As with anyone I setup a qlikview for. &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, 03 Dec 2014 22:54:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771287#M1045741</guid>
      <dc:creator>stevelord</dc:creator>
      <dc:date>2014-12-03T22:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771288#M1045742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forgive me if you find this to be rude, but there is a quick way and there is a right way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution marked as correct is complex, hard to maintain, not very flexible and VERY slow. Sum(If()) should never be used unless there is no alternative. If you have any amount of data then this will crawl to a halt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only short term benifit of the above solution is job security as you will certainly have to come back and change it. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 23:12:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771288#M1045742</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-12-03T23:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771289#M1045743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies if I came off as wistful.&amp;nbsp; In reality this is for a single straight table evaluating a single spreadsheet on a monthly basis for a single worker doing a single task in temporary fashion until the task is handed off to a parent group that's building their own process.&amp;nbsp; Job security's not a concern because we tried to hand this one off earlier and were asked to hold another year. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A better distinction might be one between 'good' and 'optimal' and not wrong or right.&amp;nbsp; The first answer to meet my specific business need and solve my specific problem was correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done counting in script for large-scale solutions, and found myself having to revisit and break those processes down to smaller chunks due to infrastructure limits, so even a nice simple count() group by in script can get complicated if the dataset is very large and the infrastructure is a step behind.&amp;nbsp; Even so those were the best/only way to do the computations on the large scale.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 14:54:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771289#M1045743</guid>
      <dc:creator>stevelord</dc:creator>
      <dc:date>2014-12-04T14:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Expression help, count the number of people whose substring count =1 or 2</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771290#M1045744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, it’s two big spreadsheets but it was a crazy amount of work the worker was doing to manually count the stuff in excel, and still very small/quick by qlikview standards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Lord&lt;/P&gt;&lt;P&gt;Senior Reporting Analyst&lt;/P&gt;&lt;P&gt;direct: 240.482.8552&lt;/P&gt;&lt;P&gt;&amp;lt;http://www.livehealthier.com/&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 14:59:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-help-count-the-number-of-people-whose-substring-count/m-p/771290#M1045744</guid>
      <dc:creator>stevelord</dc:creator>
      <dc:date>2014-12-04T14:59:52Z</dc:date>
    </item>
  </channel>
</rss>

