<?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: Aggregating duplicate values in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530258#M107785</link>
    <description>&lt;P&gt;Hi Oleg,&lt;/P&gt;&lt;P&gt;Thanks for your suggestions.&lt;/P&gt;&lt;P&gt;The expression you wrote didn't resolve the issue.&lt;BR /&gt;I did try to use two different tables, but it didn't help either.&lt;BR /&gt;The composite key I used : Department and Year-Month.&lt;/P&gt;&lt;P&gt;Is the key I used correct?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Sep 2025 15:40:47 GMT</pubDate>
    <dc:creator>dana</dc:creator>
    <dc:date>2025-09-09T15:40:47Z</dc:date>
    <item>
      <title>Aggregating duplicate values</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530245#M107782</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;The issue was posted here as well in a simplified way, and was resolved:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values-over-periods/td-p/2530299" target="_blank"&gt;https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values-over-periods/td-p/2530299&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi People,&lt;/P&gt;&lt;P&gt;I have created a table in a script, which has calculated &amp;nbsp;monthly totals from 2 facts:&lt;/P&gt;&lt;P&gt;Firstly, I aggregate &lt;STRONG&gt;Sick Patient Count&lt;/STRONG&gt; based on the following key fields :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Disease&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Department&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Patient Status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Disease State&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Year-Monthy&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Then I add &amp;nbsp;(left join) to the table the Total Patients Count by Department and Year- Month.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dana_0-1757428290273.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/183532i3739E7FE0820BD46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dana_0-1757428290273.png" alt="dana_0-1757428290273.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So, for 2 different key fields in a department and month, the total patients is the same (44).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table in the UI should display :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Disease&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Department&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sick Patient Count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Total Patients Count&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Patient Status and Disease State are used as filters.&lt;/P&gt;&lt;P&gt;The issue is getting duplicate values in cases where&amp;nbsp; there different key values for a department (88).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dana_1-1757428400654.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/183534iDCD344B926A27E7E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dana_1-1757428400654.png" alt="dana_1-1757428400654.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions are:&lt;/P&gt;&lt;P&gt;1 How do I display the same values for a department regardless of a disease?&lt;/P&gt;&lt;P&gt;2 The table is not suppose to include month or year, but should always show the same values for a department regardless of the periods selected.&lt;/P&gt;&lt;P&gt;3 How is the Total line of the table should be calculated?&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 14:47:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530245#M107782</guid>
      <dc:creator>dana</dc:creator>
      <dc:date>2025-09-10T14:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating duplicate values</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530256#M107784</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/68009"&gt;@dana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Ideally, these duplication situations should be avoided by data modeling - different levels of detail should be kept in separate tables and linked with composite keys, or concatenated in a concatenated fact table.&lt;/P&gt;&lt;P&gt;If you have to join the two tables, then a less elegant solution would involve using the AGGR() function. If simple sum(Patients) returns duplicate values, you can avoid it by using the following:&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;AGGR( min(Patients), Department, YeaMonth)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;This formula will pick one (minimal) value of Patients by Department and YearMonth, and then sum up these distinct values to the level of your chart dimensions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Allow me to invite you to my &lt;A href="https://www.hpartner.at/qlik-expert-class-en/" target="_blank" rel="noopener"&gt;Qlik Expert Class&lt;/A&gt; that I'll be teaching in Vienna, Austria on September 22-24. I will be teaching advanced data modeling, covering some of these challenges, along with advanced scripting, performance optimization, and advanced aggregation and Set Analysis techniques. You will learn the most advanced Qlik methodologies that will help you solve tough problems like this one.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 15:28:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530256#M107784</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-09-09T15:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating duplicate values</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530258#M107785</link>
      <description>&lt;P&gt;Hi Oleg,&lt;/P&gt;&lt;P&gt;Thanks for your suggestions.&lt;/P&gt;&lt;P&gt;The expression you wrote didn't resolve the issue.&lt;BR /&gt;I did try to use two different tables, but it didn't help either.&lt;BR /&gt;The composite key I used : Department and Year-Month.&lt;/P&gt;&lt;P&gt;Is the key I used correct?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 15:40:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530258#M107785</guid>
      <dc:creator>dana</dc:creator>
      <dc:date>2025-09-09T15:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating duplicate values</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530369#M107800</link>
      <description>&lt;P&gt;Yes, this is the correct key. It's hard for me to guess what's wrong in your app without seeing it.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 12:51:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530369#M107800</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2025-09-10T12:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating duplicate values</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530397#M107803</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I have created a simpler model, and published a new post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values-over-periods/td-p/2530299" target="_blank"&gt;https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values-over-periods/td-p/2530299&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The issue was resolved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Sep 2025 14:50:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-duplicate-values/m-p/2530397#M107803</guid>
      <dc:creator>dana</dc:creator>
      <dc:date>2025-09-10T14:50:23Z</dc:date>
    </item>
  </channel>
</rss>

