<?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: Nested Sum(Aggr(Sum())) and match with Criteria in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734064#M452479</link>
    <description>&lt;P&gt;May be try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(Aggr(
 If(
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type = {'Cosmetics'}, 
Category = {'Category-6'}&amp;gt;} Achieved) &amp;gt;= 14
  or
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type ={'Cosmetics'}, Category = {'Category-13'}&amp;gt;} Achieved)
 , Visit)
, Visit, Category))&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 07 Aug 2020 10:55:54 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2020-08-07T10:55:54Z</dc:date>
    <item>
      <title>Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734047#M452478</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a scenario of calculating a &lt;STRONG&gt;Visit&lt;/STRONG&gt; as &lt;STRONG&gt;Compliant&lt;/STRONG&gt; based on the &lt;STRONG&gt;Categories &lt;/STRONG&gt;(if matching criteria). But i am unable to do a nested sum or overall count on below expression. Can you please guide and help me out.&lt;/P&gt;&lt;P&gt;I will be very thankful to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CRITERIA:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Category-6 : 14&lt;/P&gt;&lt;P&gt;Category-13: 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TRIED EXPRESSION:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;if&lt;/FONT&gt;(&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;sum&lt;/FONT&gt;(&lt;FONT color="#0000FF"&gt;aggr&lt;/FONT&gt;(&lt;FONT color="#0000FF"&gt;sum&lt;/FONT&gt;({&amp;lt;&lt;FONT color="#993300"&gt;Parameter&lt;/FONT&gt;={'OSA-1','OSA-2','OSA-3'},&lt;FONT color="#993300"&gt;Store_Type&lt;/FONT&gt;={'Cosmetics'},&lt;FONT color="#993300"&gt;Category&lt;/FONT&gt;={'Category-6'}&amp;gt;}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Achieved&lt;/FONT&gt;),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Storecode&lt;/FONT&gt;,&lt;FONT color="#993300"&gt;Visit&lt;/FONT&gt;,&lt;FONT color="#993300"&gt;Category&lt;/FONT&gt;))&lt;BR /&gt;&amp;gt;=14,1,0)&lt;BR /&gt;+&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if&lt;/FONT&gt;(&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;sum&lt;/FONT&gt;(&lt;FONT color="#0000FF"&gt;aggr&lt;/FONT&gt;(&lt;FONT color="#0000FF"&gt;sum&lt;/FONT&gt;({&amp;lt;&lt;FONT color="#993300"&gt;Parameter&lt;/FONT&gt;={'OSA-1','OSA-2','OSA-3'},&lt;FONT color="#993300"&gt;Store_Type&lt;/FONT&gt;={'Cosmetics'},&lt;FONT color="#993300"&gt;Category&lt;/FONT&gt;={'Category-13'}&amp;gt;}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Achieved&lt;/FONT&gt;),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#993300"&gt;Storecode&lt;/FONT&gt;,&lt;FONT color="#993300"&gt;Visit&lt;/FONT&gt;,&lt;FONT color="#993300"&gt;Category&lt;/FONT&gt;))&lt;BR /&gt;&amp;gt;=10,1,0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA and RESULT I AM GETTING vs EXPECTED:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="OSA Data.jpg" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38681i1090B910FFBC87A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="OSA Data.jpg" alt="OSA Data.jpg" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:15:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734047#M452478</guid>
      <dc:creator>danyal1990</dc:creator>
      <dc:date>2024-11-16T18:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734064#M452479</link>
      <description>&lt;P&gt;May be try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(Aggr(
 If(
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type = {'Cosmetics'}, 
Category = {'Category-6'}&amp;gt;} Achieved) &amp;gt;= 14
  or
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type ={'Cosmetics'}, Category = {'Category-13'}&amp;gt;} Achieved)
 , Visit)
, Visit, Category))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Aug 2020 10:55:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734064#M452479</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-08-07T10:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734095#M452482</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp; Really appreciate your effort.&lt;/P&gt;&lt;P&gt;i tried your provided solution but it is not returning any result.&lt;/P&gt;&lt;P&gt;Can you please suggest some more option?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 12:55:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734095#M452482</guid>
      <dc:creator>danyal1990</dc:creator>
      <dc:date>2020-08-07T12:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734161#M452485</link>
      <description>&lt;P&gt;Sorry my bad, can you try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count(DISTINCT Aggr(
 If(
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type = {'Cosmetics'}, 
Category = {'Category-6'}&amp;gt;} Achieved) &amp;gt;= 14
  or
  Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type ={'Cosmetics'}, Category = {'Category-13'}&amp;gt;} Achieved)
 , Visit)
, Visit, Category))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Aug 2020 15:29:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734161#M452485</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-08-07T15:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734247#M452492</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your updated expression and it is producing near perfect results. Can you please help one more time?&lt;/P&gt;&lt;P&gt;The problem is that it is not checking if both the categories are compliant for the visit.&lt;/P&gt;&lt;P&gt;After changing the Data for one &lt;STRONG&gt;Category&lt;/STRONG&gt; of &lt;STRONG&gt;Visit-1 &lt;/STRONG&gt;but the expression still counting that&lt;STRONG&gt; Visit &lt;/STRONG&gt;as&lt;STRONG&gt; Compliant&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;It should be excluded.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MODIFIED EXPRESSION:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;=&lt;FONT color="#0000FF"&gt;Count&lt;/FONT&gt;(&lt;FONT color="#0000FF"&gt;DISTINCT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Aggr&lt;/FONT&gt;(&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;If&lt;/FONT&gt;(&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Sum&lt;/FONT&gt;({&amp;lt;&lt;FONT color="#993300"&gt;Parameter&lt;/FONT&gt; = {'OSA-1','OSA-2','OSA-3'}, &lt;FONT color="#993300"&gt;Store_Type&lt;/FONT&gt; = {'Cosmetics'},&lt;FONT color="#993300"&gt;Category&lt;/FONT&gt; = {'Category-6'}&amp;gt;} &lt;FONT color="#993300"&gt;Achieved&lt;/FONT&gt;) &amp;gt;= 14&lt;BR /&gt;or&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Sum&lt;/FONT&gt;({&amp;lt;&lt;FONT color="#993300"&gt;Parameter&lt;/FONT&gt; = {'OSA-1','OSA-2','OSA-3'}, &lt;FONT color="#993300"&gt;Store_Type&lt;/FONT&gt; ={'Cosmetics'}, &lt;FONT color="#993300"&gt;Category&lt;/FONT&gt; = {'Category-13'}&amp;gt;} &lt;FONT color="#993300"&gt;Achieved&lt;/FONT&gt;) &amp;gt;= 10&lt;BR /&gt;,&lt;FONT color="#993300"&gt;Visit&lt;/FONT&gt;)&lt;BR /&gt;,&lt;FONT color="#993300"&gt;Visit&lt;/FONT&gt;, &lt;FONT color="#993300"&gt;Category&lt;/FONT&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Changed DATA &lt;/STRONG&gt;still counting &lt;STRONG&gt;Visit-1 &lt;/STRONG&gt;as&lt;STRONG&gt; Compliant &lt;/STRONG&gt;based on only&lt;STRONG&gt; 1 Category &lt;/STRONG&gt;while it should check both&lt;STRONG&gt; Categories:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Changed Data.jpg" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38733iB65F532DAD1131C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Changed Data.jpg" alt="Changed Data.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 19:37:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734247#M452492</guid>
      <dc:creator>danyal1990</dc:creator>
      <dc:date>2020-08-07T19:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Sum(Aggr(Sum())) and match with Criteria</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734254#M452493</link>
      <description>&lt;P&gt;try below&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;count(distinct aggr(if(sum(total&amp;lt;Store_Type,Category&amp;gt;aggr(if(Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type = {'Cosmetics'},Category = {'Category-6'}&amp;gt;} Achieved) &amp;gt;=14,1),Category,Store_Type))=1,Visit),Category,Store_Type,Parameter))
+
count(distinct aggr(if(sum(total&amp;lt;Store_Type,Category&amp;gt;aggr(if(Sum({&amp;lt;Parameter = {'OSA-1','OSA-2','OSA-3'}, Store_Type ={'Cosmetics'}, Category = {'Category-13'}&amp;gt;} Achieved) &amp;gt;=10,1),Category,Store_Type))=1,Visit),Category,Store_Type,Parameter))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Aug 2020 21:15:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-Sum-Aggr-Sum-and-match-with-Criteria/m-p/1734254#M452493</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-08-07T21:15:02Z</dc:date>
    </item>
  </channel>
</rss>

