<?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: Group by working in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472283#M99774</link>
    <description>&lt;P&gt;try below script&lt;/P&gt;
&lt;P&gt;tab:&lt;BR /&gt;load * inline [&lt;BR /&gt;player,score&lt;BR /&gt;p1,30&lt;BR /&gt;p2,40&lt;BR /&gt;p1,50&lt;BR /&gt;p3,50&lt;BR /&gt;p4,20&lt;BR /&gt;p2,100&lt;BR /&gt;p5,90&lt;BR /&gt;p3,100&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;tab1:&lt;BR /&gt;Load * Resident tab order by player;&lt;/P&gt;
&lt;P&gt;NoConcatenate &lt;BR /&gt;tab2:&lt;BR /&gt;Load player, sum(score) as Total_score Resident tab1 Group by player;&lt;/P&gt;
&lt;P&gt;NoConcatenate &lt;BR /&gt;final_tab:&lt;BR /&gt;Load player, Total_score,Total_score+if(IsNull(Previous(Total_score)),0,Previous(Total_score)) as Previous_score Resident tab2;&lt;/P&gt;
&lt;P&gt;Drop Table tab,tab1,tab2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrashantSangle_0-1721717522605.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/169780i071F4D590398E276/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrashantSangle_0-1721717522605.png" alt="PrashantSangle_0-1721717522605.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Prashant Sangle&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 06:52:13 GMT</pubDate>
    <dc:creator>PrashantSangle</dc:creator>
    <dc:date>2024-07-23T06:52:13Z</dc:date>
    <item>
      <title>Group by working</title>
      <link>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472277#M99773</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;tab:&lt;BR /&gt;load * inline [&lt;BR /&gt;player,score&lt;BR /&gt;p1,30&lt;BR /&gt;p2,40&lt;BR /&gt;p1,50&lt;BR /&gt;p3,50&lt;BR /&gt;p4,20&lt;BR /&gt;p2,100&lt;BR /&gt;p5,90&lt;BR /&gt;p3,100&lt;BR /&gt;];&lt;BR /&gt;tab2:&lt;BR /&gt;load player1 ,if(isNull(score1+previous(score1)),score1,score1+previous(score1)) as score1;&lt;BR /&gt;load player as player1,sum(score) as score1 Resident tab group by player;&lt;/P&gt;
&lt;P&gt;if I try to write algorithm for above script whether it would be as below:&lt;/P&gt;
&lt;P&gt;key_index={}&lt;/P&gt;
&lt;P&gt;key_sum_arr=[]&lt;/P&gt;
&lt;P&gt;key_previous_arr=[]&lt;/P&gt;
&lt;P&gt;score_array=[]&lt;/P&gt;
&lt;P&gt;final=[]&lt;/P&gt;
&lt;P&gt;iterating through each rows and updating key_index and adding score to array based on index&lt;/P&gt;
&lt;P&gt;key_index={p1:0,p2:1,p3:2,p4:3,p4:4}&lt;/P&gt;
&lt;P&gt;score_array=[[30,50],[40,100],[50,100],[20],[90]]&lt;/P&gt;
&lt;P&gt;iterating through key_index and taking sum of score_array based on key and index and the previous function will take the last appended element in an array.&lt;/P&gt;
&lt;P&gt;key_sum_arr=[80,140,150,20,90]&lt;/P&gt;
&lt;P&gt;key_previous_arr=[80,220,290,170,110]&lt;/P&gt;
&lt;P&gt;iterate through key_index and update final array by adding element from&amp;nbsp;key_sum_arr and&amp;nbsp;key_previous_arr based on key_index value&lt;/P&gt;
&lt;P&gt;final=[[p1,80,80],[p2,140,220],[p3,150,290],[p4,20,170],[p5,90,110]]&lt;/P&gt;
&lt;P&gt;final is the required output.&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 06:22:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472277#M99773</guid>
      <dc:creator>vajid4525</dc:creator>
      <dc:date>2024-07-23T06:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Group by working</title>
      <link>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472283#M99774</link>
      <description>&lt;P&gt;try below script&lt;/P&gt;
&lt;P&gt;tab:&lt;BR /&gt;load * inline [&lt;BR /&gt;player,score&lt;BR /&gt;p1,30&lt;BR /&gt;p2,40&lt;BR /&gt;p1,50&lt;BR /&gt;p3,50&lt;BR /&gt;p4,20&lt;BR /&gt;p2,100&lt;BR /&gt;p5,90&lt;BR /&gt;p3,100&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;tab1:&lt;BR /&gt;Load * Resident tab order by player;&lt;/P&gt;
&lt;P&gt;NoConcatenate &lt;BR /&gt;tab2:&lt;BR /&gt;Load player, sum(score) as Total_score Resident tab1 Group by player;&lt;/P&gt;
&lt;P&gt;NoConcatenate &lt;BR /&gt;final_tab:&lt;BR /&gt;Load player, Total_score,Total_score+if(IsNull(Previous(Total_score)),0,Previous(Total_score)) as Previous_score Resident tab2;&lt;/P&gt;
&lt;P&gt;Drop Table tab,tab1,tab2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrashantSangle_0-1721717522605.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/169780i071F4D590398E276/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrashantSangle_0-1721717522605.png" alt="PrashantSangle_0-1721717522605.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Prashant Sangle&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 06:52:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472283#M99774</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2024-07-23T06:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Group by working</title>
      <link>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472289#M99776</link>
      <description>&lt;P&gt;that's not my query&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 07:10:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Group-by-working/m-p/2472289#M99776</guid>
      <dc:creator>vajid4525</dc:creator>
      <dc:date>2024-07-23T07:10:01Z</dc:date>
    </item>
  </channel>
</rss>

