<?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 to sum up transaction data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/aggr-function-to-sum-up-transaction-data/m-p/425437#M486860</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data of transactions:&lt;/P&gt;&lt;P&gt;category, supplier, brand, item, etc'.&lt;/P&gt;&lt;P&gt;each transaction may contain more then one row, category has several suppliers, which has several brand, which has several items.&lt;/P&gt;&lt;P&gt;also for each transaction row i have a field indicating the number of clients (1,0 or -1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create two tables with category, supplier &amp;amp; brand as dimensions, &lt;/P&gt;&lt;P&gt;and sum(amount) over quantities as expressions, in one table. and sum(clients) over quantities in the second&lt;/P&gt;&lt;P&gt;meaning my expressions are sum(amount) for all transaction that has 1 item, sum(amount) for all transaction that has 2 items, etc'.&lt;/P&gt;&lt;P&gt;and sum(clients) for all transaction that has 1 item, sum(clients) for all transaction that has 2 items, etc'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm trying to use the expressions:&lt;/P&gt;&lt;P&gt;sum((if(aggr(sum(Sales_Qnty), transaction, category, supplier, brand)=1,amount)&lt;/P&gt;&lt;P&gt;sum((if(aggr(sum(Sales_Qnty), transaction, category, supplier, brand)=1,clients)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it's not adding up:&lt;/P&gt;&lt;P&gt;i get 1 client for:&lt;/P&gt;&lt;P&gt;make up, accessories, revlon&lt;/P&gt;&lt;P&gt;make up, accessories, D&amp;amp;G&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when i collapse brand i get&lt;/P&gt;&lt;P&gt;make up, accessories, 2 client.&lt;/P&gt;&lt;P&gt;when the correct answer is 1 client, as 1 client made the all transaction buying all those items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on the amount table on the other hand i have a brand with two items, each costs 1.5$.&lt;/P&gt;&lt;P&gt;i get a line:&lt;/P&gt;&lt;P&gt;sweets &amp;amp; food, sweets, must, 1.5$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of :&lt;/P&gt;&lt;P&gt;sweets &amp;amp; food, sweets, must, 3$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and of course both table don't add up when i choose more than one transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone can direct me in the right way?&lt;/P&gt;&lt;P&gt;Do i use expreesions, or can i create calculated dimension to get the 1,2,3,... quantities as dimension?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 10 Mar 2013 08:26:33 GMT</pubDate>
    <dc:creator>raz-datamind</dc:creator>
    <dc:date>2013-03-10T08:26:33Z</dc:date>
    <item>
      <title>aggr() function to sum up transaction data</title>
      <link>https://community.qlik.com/t5/QlikView/aggr-function-to-sum-up-transaction-data/m-p/425437#M486860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data of transactions:&lt;/P&gt;&lt;P&gt;category, supplier, brand, item, etc'.&lt;/P&gt;&lt;P&gt;each transaction may contain more then one row, category has several suppliers, which has several brand, which has several items.&lt;/P&gt;&lt;P&gt;also for each transaction row i have a field indicating the number of clients (1,0 or -1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create two tables with category, supplier &amp;amp; brand as dimensions, &lt;/P&gt;&lt;P&gt;and sum(amount) over quantities as expressions, in one table. and sum(clients) over quantities in the second&lt;/P&gt;&lt;P&gt;meaning my expressions are sum(amount) for all transaction that has 1 item, sum(amount) for all transaction that has 2 items, etc'.&lt;/P&gt;&lt;P&gt;and sum(clients) for all transaction that has 1 item, sum(clients) for all transaction that has 2 items, etc'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm trying to use the expressions:&lt;/P&gt;&lt;P&gt;sum((if(aggr(sum(Sales_Qnty), transaction, category, supplier, brand)=1,amount)&lt;/P&gt;&lt;P&gt;sum((if(aggr(sum(Sales_Qnty), transaction, category, supplier, brand)=1,clients)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it's not adding up:&lt;/P&gt;&lt;P&gt;i get 1 client for:&lt;/P&gt;&lt;P&gt;make up, accessories, revlon&lt;/P&gt;&lt;P&gt;make up, accessories, D&amp;amp;G&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when i collapse brand i get&lt;/P&gt;&lt;P&gt;make up, accessories, 2 client.&lt;/P&gt;&lt;P&gt;when the correct answer is 1 client, as 1 client made the all transaction buying all those items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on the amount table on the other hand i have a brand with two items, each costs 1.5$.&lt;/P&gt;&lt;P&gt;i get a line:&lt;/P&gt;&lt;P&gt;sweets &amp;amp; food, sweets, must, 1.5$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of :&lt;/P&gt;&lt;P&gt;sweets &amp;amp; food, sweets, must, 3$&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and of course both table don't add up when i choose more than one transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone can direct me in the right way?&lt;/P&gt;&lt;P&gt;Do i use expreesions, or can i create calculated dimension to get the 1,2,3,... quantities as dimension?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 08:26:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggr-function-to-sum-up-transaction-data/m-p/425437#M486860</guid>
      <dc:creator>raz-datamind</dc:creator>
      <dc:date>2013-03-10T08:26:33Z</dc:date>
    </item>
  </channel>
</rss>

