<?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: Sum Distinct Invoice Numbers in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sum-Distinct-Invoice-Numbers/m-p/1826220#M67942</link>
    <description>&lt;P&gt;Maybe an aggregated aggregation is what you are trying to to do. Take a look at this example.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_0-1627973301310.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59583i7CD0D7F41672EF96/image-size/large?v=v2&amp;amp;px=999" role="button" title="Vegar_0-1627973301310.png" alt="Vegar_0-1627973301310.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression I've used is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;SUM(aggr(SUM(distinct QUANTITY),INVOICE,[PRODUCT CODE]))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I where not you able to reproduce the figures&amp;nbsp; &lt;SPAN&gt;5.170&amp;nbsp;&lt;/SPAN&gt;your Sheet.xlsx as a data source? If my suggestion above does not solve your issue then please provide a load script that reads your excel in a correct manner. For my solution I did this data model.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_1-1627973446661.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59584iDF2A68B7A8F79F32/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Vegar_1-1627973446661.png" alt="Vegar_1-1627973446661.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 06:50:58 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2021-08-03T06:50:58Z</dc:date>
    <item>
      <title>Sum Distinct Invoice Numbers</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-Distinct-Invoice-Numbers/m-p/1826183#M67936</link>
      <description>&lt;P&gt;Hey guys.&lt;/P&gt;&lt;P&gt;I have a sheet (attached) that brings me the invoices, quantity sold of the item, and the barcode of them.&lt;/P&gt;&lt;P&gt;In that sheet, it brings me repeatedly the total of items sold in that invoice and if I sum it, it goes wrong.&lt;/P&gt;&lt;P&gt;There are different invoices with the same count of items sold. The "DISTINCT" takes it out of the sum.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the below table, "Qtde. Faturada" refers to&amp;nbsp;SUM(DISTINCT IF(NUMNFV,QTDFAT)).&lt;/P&gt;&lt;P&gt;The total row at the top shows 2.950, but it needs to show 5.170&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arielrodrigues_0-1627936240448.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59569i92EBF1DF09C40E65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arielrodrigues_0-1627936240448.png" alt="arielrodrigues_0-1627936240448.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I only get the satisfying result if I change the way this, from "Total of Expression" to "Sum rows"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arielrodrigues_2-1627936648729.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59571i4630345C6F18BDC2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arielrodrigues_2-1627936648729.png" alt="arielrodrigues_2-1627936648729.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To make a chart after that, it's the same problem. Does anyone have an answer to that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:39:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-Distinct-Invoice-Numbers/m-p/1826183#M67936</guid>
      <dc:creator>arielrodrigues</dc:creator>
      <dc:date>2021-08-02T20:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum Distinct Invoice Numbers</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-Distinct-Invoice-Numbers/m-p/1826220#M67942</link>
      <description>&lt;P&gt;Maybe an aggregated aggregation is what you are trying to to do. Take a look at this example.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_0-1627973301310.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59583i7CD0D7F41672EF96/image-size/large?v=v2&amp;amp;px=999" role="button" title="Vegar_0-1627973301310.png" alt="Vegar_0-1627973301310.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression I've used is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;SUM(aggr(SUM(distinct QUANTITY),INVOICE,[PRODUCT CODE]))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I where not you able to reproduce the figures&amp;nbsp; &lt;SPAN&gt;5.170&amp;nbsp;&lt;/SPAN&gt;your Sheet.xlsx as a data source? If my suggestion above does not solve your issue then please provide a load script that reads your excel in a correct manner. For my solution I did this data model.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_1-1627973446661.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59584iDF2A68B7A8F79F32/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Vegar_1-1627973446661.png" alt="Vegar_1-1627973446661.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 06:50:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-Distinct-Invoice-Numbers/m-p/1826220#M67942</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2021-08-03T06:50:58Z</dc:date>
    </item>
  </channel>
</rss>

