<?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: Aggregation issues with Keep statement in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2461911#M98914</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149129"&gt;@TauseefKhan&lt;/a&gt;&amp;nbsp;, Thanks so much for advising alternate solution. We have a lot of tables associated using Keep across our apps, I am worried if the aggregated values are correct. Let me try to fit your solution into our data model and see how it works. Thanks again.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 19:51:31 GMT</pubDate>
    <dc:creator>MAK_21</dc:creator>
    <dc:date>2024-06-12T19:51:31Z</dc:date>
    <item>
      <title>Aggregation issues with Keep statement</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460345#M98791</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We ran into aggregation issues with "Keep" statement. When I change Keep to Join, the aggregation works as expected. Here is the script and what's expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;X:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LOAD * Inline[&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TICKET_NBR, TRAN_DATE_KEY, TRAN_NBR, TRAN_KEY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A1, 10, 1, 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A1, 10, 2, 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A1, 11, 3, 1001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A2, 10, 1, 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A2, 10, 2, 1001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A3, 10, 1, 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A3, 10, 2, 1001&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A3, 11, 3, 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Left Keep (X)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Y:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LOAD * Inline[&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TRAN_KEY, AMT&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1000, 200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1001, 500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1002, 100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Straight table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For TICKET_NBR A1, TRAN_KEY 1000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Count(AMT) should be 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sum(AMT) should be 400&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Count(TRAN_KEY) is 2 and it is correct&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sum(TRAN_KEY) is 2000 and it is correct&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Same case with TKT_NBR A3 as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kindly look into this and advise a solution. I have attached the qvw for reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mahesh&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 19:23:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460345#M98791</guid>
      <dc:creator>MAK_21</dc:creator>
      <dc:date>2024-06-07T19:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation issues with Keep statement</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460390#M98792</link>
      <description>&lt;P&gt;The Qlik Engine is calculating correctly. If you use a "Left Keep" you will get&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hic_0-1717794538379.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167573iCE79364F94E7120F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hic_0-1717794538379.png" alt="hic_0-1717794538379.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and then&amp;nbsp;Count(AMT) is 1 and Sum(AMT) 200. See the yellow marked cells.&lt;/P&gt;
&lt;P&gt;However, if you join the tables, you will get&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hic_1-1717794717465.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167574iABCA13C6DF9DF2F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hic_1-1717794717465.png" alt="hic_1-1717794717465.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and then the numbers change. Count(AMT) is now 2 and Sum(AMT) is 400.&lt;/P&gt;
&lt;P&gt;This is the way it should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 21:12:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460390#M98792</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2024-06-07T21:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation issues with Keep statement</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460437#M98797</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/202948"&gt;@MAK_21&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;If you must keep the tables separate for some reason, you can use a mapping load to create a mapping table that will allow you to associate the AMT values with the TRAN_KEY without duplicating rows as your required output.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TauseefKhan_0-1717862648877.png" style="width: 444px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167581i13326F52E4737B1E/image-dimensions/444x172?v=v2" width="444" height="172" role="button" title="TauseefKhan_0-1717862648877.png" alt="TauseefKhan_0-1717862648877.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Table_2:&lt;BR /&gt;Mapping Load&lt;BR /&gt;* Inline [&lt;BR /&gt;TRAN_KEY, AMT&lt;BR /&gt;1000, 200&lt;BR /&gt;1001, 500&lt;BR /&gt;1002, 100&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;X:&lt;BR /&gt;LOAD *,&lt;BR /&gt;ApplyMap('Table_2',TRAN_KEY,0) As AMT&lt;BR /&gt;Inline [&lt;BR /&gt;TICKET_NBR, TRAN_DATE_KEY, TRAN_NBR, TRAN_KEY&lt;BR /&gt;A1, 10, 1, 1000&lt;BR /&gt;A1, 10, 2, 1000&lt;BR /&gt;A1, 11, 3, 1001&lt;BR /&gt;A2, 10, 1, 1000&lt;BR /&gt;A2, 10, 2, 1001&lt;BR /&gt;A3, 10, 1, 1000&lt;BR /&gt;A3, 10, 2, 1001&lt;BR /&gt;A3, 11, 3, 1000&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;***Hope this resolve your issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the issue is solved please mark the answer with Accept as Solution &amp;amp; like it.***&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2024 16:09:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2460437#M98797</guid>
      <dc:creator>TauseefKhan</dc:creator>
      <dc:date>2024-06-08T16:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation issues with Keep statement</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2461268#M98874</link>
      <description>&lt;P&gt;Thank you for responding to my question.&lt;/P&gt;
&lt;P&gt;For testing purposes, I would like to try the same aggregation on another Number field TRAN_KEY and&amp;nbsp;the numbers come correct. &lt;SPAN&gt;Count(TRAN_KEY) is 2 and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Sum(TRAN_KEY) is 2000. I initially thought it might be because of these fields present in the Left table X but when I change the association to Right Keep or Inner&amp;nbsp; Keep,&amp;nbsp;they are still unchanged. Can you please throw some light on it?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 13:54:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2461268#M98874</guid>
      <dc:creator>MAK_21</dc:creator>
      <dc:date>2024-06-11T13:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation issues with Keep statement</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2461911#M98914</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149129"&gt;@TauseefKhan&lt;/a&gt;&amp;nbsp;, Thanks so much for advising alternate solution. We have a lot of tables associated using Keep across our apps, I am worried if the aggregated values are correct. Let me try to fit your solution into our data model and see how it works. Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 19:51:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregation-issues-with-Keep-statement/m-p/2461911#M98914</guid>
      <dc:creator>MAK_21</dc:creator>
      <dc:date>2024-06-12T19:51:31Z</dc:date>
    </item>
  </channel>
</rss>

