<?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 sum in Pivot table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204942#M61641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's working just like you want it for me, so I probably have something set differently than you, and the difference is probably your answer. That or your real data model is somewhat more complicated than your example, which also seems likely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Oct 2009 01:18:36 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2009-10-02T01:18:36Z</dc:date>
    <item>
      <title>sum in Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204941#M61640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I'm quite new to QlikView and I have been working on this problem the whole day. I can't solve it. So maybe one of you can tell me where I made the mistake.&lt;/P&gt;&lt;P&gt;I have two fact tables:&lt;/P&gt;&lt;P&gt;1) SalesEntries&lt;/P&gt;&lt;P&gt;ItemNo SalesAmount&lt;BR /&gt;-------------------------------------&lt;BR /&gt;1000 500.-&lt;BR /&gt;1000 250.-&lt;BR /&gt;1000 250.-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) ReturnEntries&lt;/P&gt;&lt;P&gt;ItemNo ReturnAmount ReasonCode&lt;BR /&gt;-----------------------------------------------------------&lt;BR /&gt;1000 100.- BROKEN&lt;BR /&gt;1000 100.- COLOR&lt;/P&gt;&lt;P&gt;I want to calculate a return ratio and display it in a pivot table. The table looks like this:&lt;/P&gt;&lt;P&gt;ItemNo ReasonCode SalesAmount ReturnAmount Ratio&lt;/P&gt;&lt;P&gt;If I do not expand the reason codes everything is alright. The table looks like this:&lt;/P&gt;&lt;P&gt;ItemNo ReasonCode SalesAmount ReturnAmount Ratio&lt;BR /&gt;---------------------------------------------------------------------------------------------&lt;BR /&gt;1000 - 1000.- 200.- 20 %&lt;/P&gt;&lt;P&gt;If I expand them it looks like this:&lt;/P&gt;&lt;P&gt;ItemNo ReasonCode SalesAmount ReturnAmount Ratio&lt;BR /&gt;---------------------------------------------------------------------------------------------&lt;BR /&gt;1000 - 1000.- 0.- 20 %&lt;BR /&gt; BROKEN 0.- 100.- n/a&lt;BR /&gt; COLOR 0.- 100.- n/a&lt;/P&gt;&lt;P&gt;The problem now is that I understand why QliView does this, but I want the table to look like this:&lt;/P&gt;&lt;P&gt;ItemNo ReasonCode SalesAmount ReturnAmount Ratio&lt;BR /&gt;---------------------------------------------------------------------------------------------&lt;BR /&gt;1000 - 1000.- 200.- 20 %&lt;BR /&gt; BROKEN 1000.- 100.- 10 %&lt;BR /&gt; COLOR 1000.- 100.- 10 %&lt;/P&gt;&lt;P&gt;This would give the user the possibilty to have a closer look what the ratio is on the different Reasons related the the total ReturnAmount. But I cannot figure out what formula I should use. I tried using&lt;BR /&gt;= agg (sum (SalesAmount) ItemNo) because I expected it would calculate the SalesAmount for ItemNo 1000 for each reason. But that didn't work. I also experimented with top and bottom. Didn't work out either.&lt;/P&gt;&lt;P&gt;Any one of you an idea how to solve this? Or is there a fundamental error in what I want to do here?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 01:01:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204941#M61640</guid>
      <dc:creator />
      <dc:date>2009-10-02T01:01:28Z</dc:date>
    </item>
    <item>
      <title>sum in Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204942#M61641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's working just like you want it for me, so I probably have something set differently than you, and the difference is probably your answer. That or your real data model is somewhat more complicated than your example, which also seems likely.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 01:18:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204942#M61641</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-10-02T01:18:36Z</dc:date>
    </item>
    <item>
      <title>AW:Re: sum in Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204943#M61642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, thanks alot.&lt;/P&gt;&lt;P&gt;That didn't solve the problem, but I managed to reproduce my problem in your example. You find in included here.&lt;BR /&gt;What I forgot was that there is also a connecten between the two tables with the field PostingDate. That of course I need if the user wants to see the ratio for a special month or day.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 02:43:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204943#M61642</guid>
      <dc:creator />
      <dc:date>2009-10-02T02:43:00Z</dc:date>
    </item>
    <item>
      <title>AW:Re: sum in Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204944#M61643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, not that this solves your problem, but rather than have a synthetic key for the item and date, I'd probably just concatenate these both into a single table. That doesn't in and of itself fix anything, but to me is more clear. Here is a step in the right direction. I'll try to get back to it, but I need to run off to a meeting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 02:57:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204944#M61643</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-10-02T02:57:39Z</dc:date>
    </item>
    <item>
      <title>AW:Re: AW:Re: sum in Pivot table</title>
      <link>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204945#M61644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;I Can't Believe It's Not Butter!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;It's working! After your tip with the formula&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sum(total &amp;lt;ItemCycle&amp;gt; Verkaufsbetrag)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Not even that the values for SalesAmount are right. For the Returnvalue I used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if&lt;BR /&gt;&lt;BR /&gt; (ISNULL(Reasoncode),-sum(total &amp;lt;ItemCycle&amp;gt; ReturnAmount),-Sum(ReturnAmount))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and these value are ok, too. I can even calculate a ratio for the number of shipments and returns using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if (ISNULL(Reasoncode),count(total &amp;lt;ItemCycle&amp;gt; ReturnAmount),count(ReturnAmount))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;count(total &amp;lt;ItemCycle&amp;gt; SalesAmount)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;with dividing the two values. You made me very happy. Thank you very very much.&lt;BR /&gt;I have to run off to bed now cause it's nearly 11 p.m. in Germany.&lt;/P&gt;&lt;P&gt;Thanks again and good night from Berlin.&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2009 03:42:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-in-Pivot-table/m-p/204945#M61644</guid>
      <dc:creator />
      <dc:date>2009-10-02T03:42:52Z</dc:date>
    </item>
  </channel>
</rss>

