<?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: Sum and Count If or Count If and Sum in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-and-Count-If-or-Count-If-and-Sum/m-p/1586340#M596246</link>
    <description>&lt;P&gt;I tried this and also did not return the correct value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sum(aggr(
If(count(if([cod_event]=1 or [cod_event]=11, [cod_event])) 
/ 
count(distinct [data_real]) &amp;gt;1, [valor_money])
, cod_user, cod_user))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 17:04:43 GMT</pubDate>
    <dc:creator>edugallowk</dc:creator>
    <dc:date>2019-05-29T17:04:43Z</dc:date>
    <item>
      <title>Sum and Count If or Count If and Sum</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-and-Count-If-or-Count-If-and-Sum/m-p/1586333#M596245</link>
      <description>&lt;P&gt;Hello my friends!&lt;/P&gt;&lt;P&gt;I need to add the value of users who fall into the following criteria.&lt;/P&gt;&lt;P&gt;I need to count the number of events and divide by the number of months / year. If the result is equal to or greater than 1 I need to add the value of these users.&lt;/P&gt;&lt;P&gt;number of events:&lt;BR /&gt;count (if (events = 1 or events = 2), cod_events)&lt;/P&gt;&lt;P&gt;amount of month / year&lt;BR /&gt;count (distinct data)&lt;/P&gt;&lt;P&gt;I check if users have an average equal to or greater than one:&lt;/P&gt;&lt;P&gt;count (if (events = 1 or events = 2), cod_events) /&amp;nbsp;count (distinct data)&lt;/P&gt;&lt;P&gt;so I find the users who are in this condition the script below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;count(distinct if(aggr(
(count(if([Events]=1 or [Events]=11, [Cod_Events]))
/
count(distinct [Date])) &amp;gt; 1
, username), username))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now using the same code structure, I can not get the amount spent from these users.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUM(if(aggr(
(count(if([Events]=1 or [Events]=11, [Cod_Events]))
/
count(distinct [Date])) &amp;gt; 1
, money), username))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can anyone give me a hint how to structure this script better so that it returns the correct value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:26:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-and-Count-If-or-Count-If-and-Sum/m-p/1586333#M596245</guid>
      <dc:creator>edugallowk</dc:creator>
      <dc:date>2024-11-16T03:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sum and Count If or Count If and Sum</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-and-Count-If-or-Count-If-and-Sum/m-p/1586340#M596246</link>
      <description>&lt;P&gt;I tried this and also did not return the correct value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sum(aggr(
If(count(if([cod_event]=1 or [cod_event]=11, [cod_event])) 
/ 
count(distinct [data_real]) &amp;gt;1, [valor_money])
, cod_user, cod_user))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 17:04:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-and-Count-If-or-Count-If-and-Sum/m-p/1586340#M596246</guid>
      <dc:creator>edugallowk</dc:creator>
      <dc:date>2019-05-29T17:04:43Z</dc:date>
    </item>
  </channel>
</rss>

