<?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: Aggr in set anaysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136326#M9557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;You can get the max CID in the script and then use a simple set analysis:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15372631278622023 jive_text_macro" jivemacro_uid="_15372631278622023" modifiedtitle="true"&gt;
&lt;P&gt;TA:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;PID,CID,Score&lt;/P&gt;
&lt;P&gt;1,1,20&lt;/P&gt;
&lt;P&gt;1,2,30&lt;/P&gt;
&lt;P&gt;1,3,40&lt;/P&gt;
&lt;P&gt;2,1,20&lt;/P&gt;
&lt;P&gt;2,2,30&lt;/P&gt;
&lt;P&gt;2,5,70&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LEFT JOIN LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAX(CID) AS MaxCID&lt;/P&gt;
&lt;P&gt;RESIDENT TA&lt;/P&gt;
&lt;P&gt;GROUP BY PID;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Final:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Score,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(CID=MaxCID,'Yes','No') AS Flag&lt;/P&gt;
&lt;P&gt;RESIDENT TA;&lt;/P&gt;
&lt;P&gt;DROP TABLE TA;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the front end: Sum({&amp;lt;Flag={'Yes'}&amp;gt;}Score) would return 110.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Sep 2018 09:33:09 GMT</pubDate>
    <dc:creator>Ivan_Bozov</dc:creator>
    <dc:date>2018-09-18T09:33:09Z</dc:date>
    <item>
      <title>Aggr in set anaysis</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136324#M9555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi team,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I have data like this &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;TA:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD * inline&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;[&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;PID,CID,score&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1,1,20&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1,2,30&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1,3,40&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2,1,20&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2,2,30&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2,5,70&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;];&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I am trying to find a max (CID ) for eqach PID and for that row what is the score.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I am writing following set expression but its just returning score for &lt;SPAN style="font-size: 13.3333px;"&gt;2,5,70 row&amp;nbsp; which is 70.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;sum( aggr (sum( {&amp;lt;CID={$(=Max(CID))}&amp;gt;} score),PID))&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Expected output :is sum of below rows.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;1,3,40&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2,5,70&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Request to please respond as early as possible.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Prashant&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 08:10:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136324#M9555</guid>
      <dc:creator>prashantsanchet</dc:creator>
      <dc:date>2018-09-18T08:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr in set anaysis</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136325#M9556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Find the app attached here with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 09:18:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136325#M9556</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2018-09-18T09:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr in set anaysis</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136326#M9557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;You can get the max CID in the script and then use a simple set analysis:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15372631278622023 jive_text_macro" jivemacro_uid="_15372631278622023" modifiedtitle="true"&gt;
&lt;P&gt;TA:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;PID,CID,Score&lt;/P&gt;
&lt;P&gt;1,1,20&lt;/P&gt;
&lt;P&gt;1,2,30&lt;/P&gt;
&lt;P&gt;1,3,40&lt;/P&gt;
&lt;P&gt;2,1,20&lt;/P&gt;
&lt;P&gt;2,2,30&lt;/P&gt;
&lt;P&gt;2,5,70&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LEFT JOIN LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAX(CID) AS MaxCID&lt;/P&gt;
&lt;P&gt;RESIDENT TA&lt;/P&gt;
&lt;P&gt;GROUP BY PID;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Final:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Score,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(CID=MaxCID,'Yes','No') AS Flag&lt;/P&gt;
&lt;P&gt;RESIDENT TA;&lt;/P&gt;
&lt;P&gt;DROP TABLE TA;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the front end: Sum({&amp;lt;Flag={'Yes'}&amp;gt;}Score) would return 110.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 09:33:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-in-set-anaysis/m-p/136326#M9557</guid>
      <dc:creator>Ivan_Bozov</dc:creator>
      <dc:date>2018-09-18T09:33:09Z</dc:date>
    </item>
  </channel>
</rss>

