<?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: COUNTING CUSTOMERS IMPACTED MORE THAN ONCE IN THE MONTH in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/COUNTING-CUSTOMERS-IMPACTED-MORE-THAN-ONCE-IN-THE-MONTH/m-p/1755420#M58247</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92164"&gt;@JulTorresGar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a classic example of where to use an AGGR function, start by reading the help on AGGR &lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/ChartFunctions/aggr.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Are you looking at calendar quarters, or rolling three months? If the former I would suggest creating a Quarter field, this can be done in the load script like this:&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp; [Date-calendar_date],&lt;BR /&gt;&amp;nbsp; Year([Date-calendar_date]) &amp;amp; '-Q' &amp;amp; ceil(Month([Date-calendar_date])/3) as Quarter,&lt;BR /&gt;&amp;nbsp; ... rest of your load statement ...&lt;/P&gt;&lt;P&gt;This can then be used in set analysis rather than getting each month separately.&lt;/P&gt;&lt;P&gt;If it's a rolling three months then you may want to look at &amp;gt;= and &amp;lt;= in your set analysis.&lt;/P&gt;&lt;P&gt;The expression you want will be something like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(if(count(distinct {&amp;lt;Quarter={'$(=maxstring(Quarter))'}&amp;gt;}[Date-calendar_date])&amp;gt;1,1,0),Client,Quarter))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What is happening here is that the AGGR is causing the count to be done for each client in each quarter, and then a flag of zero or one to be returned into a temporary table, with Client and Quarter as virtual dimensions. The outer sum then tots the ones up to give you the count.&lt;/P&gt;&lt;P&gt;The beauty of this is that you could remove the set analysis and have Quarter as a dimension in your table and it would count the customers who visited each month in each quarter, not just the latest.&lt;/P&gt;&lt;P&gt;Hope that all makes sense?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
    <pubDate>Fri, 23 Oct 2020 12:57:27 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2020-10-23T12:57:27Z</dc:date>
    <item>
      <title>COUNTING CUSTOMERS IMPACTED MORE THAN ONCE IN THE MONTH</title>
      <link>https://community.qlik.com/t5/App-Development/COUNTING-CUSTOMERS-IMPACTED-MORE-THAN-ONCE-IN-THE-MONTH/m-p/1755032#M58210</link>
      <description>&lt;P&gt;Good morning.&lt;BR /&gt;I am trying to carry out a count, which deals with the workers who went to visit their clients more than once a month but they ask me to do it per quarter, showing how many times they had visits more than once per month.&lt;BR /&gt;I in a simple table add these conditions:&lt;BR /&gt;1.1&lt;BR /&gt;= if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 2), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1,1,0)&lt;BR /&gt;2.2&lt;BR /&gt;if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 1), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1 , 1.0) -&lt;BR /&gt;if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 2), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1 , 1.0)&lt;BR /&gt;3.3&lt;BR /&gt;if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 0), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1 , 1.0)&lt;BR /&gt;-&lt;BR /&gt;if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 1), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1 , 1.0)&lt;BR /&gt;-&lt;BR /&gt;if (COUNT (distinct {&amp;lt;Period = {"$ (= date (AddMonths (Max ([Date-calendar_date]), - 2), 'YYYY-MM'))"}&amp;gt;} [Date-calendar_date])&amp;gt; 1 , 1.0)&lt;/P&gt;&lt;P&gt;These formulas show 1 clients who visited their clients more than once a month and zero if they had 1 or no visits.&lt;/P&gt;&lt;P&gt;then I have to count by quarter which clients visited their clients more than once.&lt;BR /&gt;please don't know how to resolve this issue.&lt;BR /&gt;I hope you can help me&lt;BR /&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/COUNTING-CUSTOMERS-IMPACTED-MORE-THAN-ONCE-IN-THE-MONTH/m-p/1755032#M58210</guid>
      <dc:creator>JulTorresGar</dc:creator>
      <dc:date>2021-12-20T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: COUNTING CUSTOMERS IMPACTED MORE THAN ONCE IN THE MONTH</title>
      <link>https://community.qlik.com/t5/App-Development/COUNTING-CUSTOMERS-IMPACTED-MORE-THAN-ONCE-IN-THE-MONTH/m-p/1755420#M58247</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92164"&gt;@JulTorresGar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a classic example of where to use an AGGR function, start by reading the help on AGGR &lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/ChartFunctions/aggr.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Are you looking at calendar quarters, or rolling three months? If the former I would suggest creating a Quarter field, this can be done in the load script like this:&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp; [Date-calendar_date],&lt;BR /&gt;&amp;nbsp; Year([Date-calendar_date]) &amp;amp; '-Q' &amp;amp; ceil(Month([Date-calendar_date])/3) as Quarter,&lt;BR /&gt;&amp;nbsp; ... rest of your load statement ...&lt;/P&gt;&lt;P&gt;This can then be used in set analysis rather than getting each month separately.&lt;/P&gt;&lt;P&gt;If it's a rolling three months then you may want to look at &amp;gt;= and &amp;lt;= in your set analysis.&lt;/P&gt;&lt;P&gt;The expression you want will be something like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(if(count(distinct {&amp;lt;Quarter={'$(=maxstring(Quarter))'}&amp;gt;}[Date-calendar_date])&amp;gt;1,1,0),Client,Quarter))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What is happening here is that the AGGR is causing the count to be done for each client in each quarter, and then a flag of zero or one to be returned into a temporary table, with Client and Quarter as virtual dimensions. The outer sum then tots the ones up to give you the count.&lt;/P&gt;&lt;P&gt;The beauty of this is that you could remove the set analysis and have Quarter as a dimension in your table and it would count the customers who visited each month in each quarter, not just the latest.&lt;/P&gt;&lt;P&gt;Hope that all makes sense?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 12:57:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/COUNTING-CUSTOMERS-IMPACTED-MORE-THAN-ONCE-IN-THE-MONTH/m-p/1755420#M58247</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-10-23T12:57:27Z</dc:date>
    </item>
  </channel>
</rss>

