<?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 AGGR Function with Distinct in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281062#M104563</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fact that you have a sum inside and outside your aggr function means that it is not actually doing anything as a result.&amp;nbsp; Do you not get the same results doing &lt;STRONG&gt;Sum(Order__c.Total_Order_Amount2__c)&lt;/STRONG&gt; as you do your current expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The purpose of aggr is to enable to you to perform an aggregation over a different type of aggregation across a specifield field or fields.&amp;nbsp; For example to sum only the most expensive known prices for each product:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(max(UnitPrice), Product))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your initial question you will need to clarify what you mean by distinct order number.&amp;nbsp; If you want to see the total order amount broken down by Order Number you would just have the order number as the dimension of a table and the simple Sum expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the issue is that the order amount is duplicated on many rows (perhaps for line items) for each order then it is a statement like this you require:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(max(Order__c.Total_Order_Amount2__c),BR_Order__c))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it would probably simplify things if you could have the order amount on a order header table and a separate line items table if this is the case.&amp;nbsp; Otherwise you will need to ensure you always use an &lt;STRONG&gt;aggr&lt;/STRONG&gt; statement whenever you reference that field - and this will hurt performance slightly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2011 22:50:56 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2011-05-06T22:50:56Z</dc:date>
    <item>
      <title>AGGR Function with Distinct</title>
      <link>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281060#M104561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please....can someone provide the correct syntax for using the AGGR and distinct fucntions? &lt;/P&gt;&lt;P&gt;This is my current formula but I need to have it sum the order total on a distinct order number. sum(aggr(Sum(Order__c.Total_Order_Amount2__c),Product2.Name))&lt;/P&gt;&lt;P&gt;The order number field will be BR_Order__c&lt;/P&gt;&lt;P&gt;Thanx&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 15:43:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281060#M104561</guid>
      <dc:creator />
      <dc:date>2011-05-06T15:43:28Z</dc:date>
    </item>
    <item>
      <title>AGGR Function with Distinct</title>
      <link>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281061#M104562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; What do you need the distinct for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using only a simple aggr(sum(Order__c.Total_Order_Amount2__c), BR_Order__c) won't do what you want?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 16:33:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281061#M104562</guid>
      <dc:creator />
      <dc:date>2011-05-06T16:33:37Z</dc:date>
    </item>
    <item>
      <title>AGGR Function with Distinct</title>
      <link>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281062#M104563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fact that you have a sum inside and outside your aggr function means that it is not actually doing anything as a result.&amp;nbsp; Do you not get the same results doing &lt;STRONG&gt;Sum(Order__c.Total_Order_Amount2__c)&lt;/STRONG&gt; as you do your current expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The purpose of aggr is to enable to you to perform an aggregation over a different type of aggregation across a specifield field or fields.&amp;nbsp; For example to sum only the most expensive known prices for each product:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(max(UnitPrice), Product))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your initial question you will need to clarify what you mean by distinct order number.&amp;nbsp; If you want to see the total order amount broken down by Order Number you would just have the order number as the dimension of a table and the simple Sum expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the issue is that the order amount is duplicated on many rows (perhaps for line items) for each order then it is a statement like this you require:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(aggr(max(Order__c.Total_Order_Amount2__c),BR_Order__c))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However it would probably simplify things if you could have the order amount on a order header table and a separate line items table if this is the case.&amp;nbsp; Otherwise you will need to ensure you always use an &lt;STRONG&gt;aggr&lt;/STRONG&gt; statement whenever you reference that field - and this will hurt performance slightly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 22:50:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AGGR-Function-with-Distinct/m-p/281062#M104563</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2011-05-06T22:50:56Z</dc:date>
    </item>
  </channel>
</rss>

