<?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 Totals expression calculation issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264427#M495705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding the pivot table dimension to the aggr() dimension list should do the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the script modification, could you upload your excel sample file here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Feb 2012 16:09:42 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-02-08T16:09:42Z</dc:date>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264423#M495701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This question is an expansion of the issues encountered in the thread &lt;A _jive_internal="true" href="https://community.qlik.com/message/189565#189565"&gt;http://community.qlik.com/message/189565#189565&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This time, I added a column called "Cost" and I used the expression Column(2) * Column(3) ("Total Employee Hours" * "Employee Hourly Cost"). The individual costs for&amp;nbsp; EMP1, EMP3, EMP4, EMP7 for the selected activity "Cu A4" are calculated correctly. The total though is 417,93 but the sum of the individuals is 341,59 and I cannot figure out why this happens.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 14:26:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264423#M495701</guid>
      <dc:creator />
      <dc:date>2012-02-08T14:26:40Z</dc:date>
    </item>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264424#M495702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this as expression for Cost:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr(&lt;/P&gt;&lt;P&gt;sum(HoursWorked) *&lt;/P&gt;&lt;P&gt;sum({&amp;lt;EmpName={"=sum(HoursWorked)&amp;gt;0"}&amp;gt;}&amp;nbsp; EmpTotalCost)&lt;/P&gt;&lt;P&gt; / sum({&amp;lt;Activities= , EmpId={"=sum(HoursWorked)&amp;gt;0"}&amp;gt;} total &amp;lt;EmpName&amp;gt; HoursWorked)&lt;/P&gt;&lt;P&gt; ,EmpName))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will get you the expected sum of rows (or try using a straight table with total mode "sum of rows").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason why you don't get the correct, expected total (well, it is correct, since the total is indeed Column(2)*column(3) ) is that you calculated your hourly costs based on total costs and the number of hours a Emp spent on ALL activities. If he spends a proportional larger or smaller amount of time on the activity you are currently selecting, you would need to use a weight to correct for this, or just use a sum of rows.&lt;/P&gt;&lt;P&gt;Not sure if I make my self clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also think it would make some things easier, if you e.g. calculate the hourly cost per employee in the script, since it seems to be static per employee.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 15:01:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264424#M495702</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-08T15:01:33Z</dc:date>
    </item>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264425#M495703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really need to use a pivot table.&lt;/P&gt;&lt;P&gt;Your answer is correct based on the information I provided you and therefore I mark it as correct. In the example I gave you, I omitted - because I thought it wouldn't matter - to add the dimension of "Activities" and that would be the columns, with the Employees being the rows. In that case, your formula works fine as long as I have made a selection of an activity. The intention though, is to have all activities and employees shown until the user makes a selection. In this case, with all activities, the column "Cost" that uses the formula you gave me, is not working correctly. If you want you can help on this problem expansion or I can post another issue?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 15:53:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264425#M495703</guid>
      <dc:creator />
      <dc:date>2012-02-08T15:53:10Z</dc:date>
    </item>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264426#M495704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added the Activities dimension in the aggr function as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;sum(aggr(&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;sum(HoursWorked) *&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;sum({&amp;lt;EmpName={"=sum(HoursWorked)&amp;gt;0"}&amp;gt;}&amp;nbsp; EmpTotalCost)&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;/ sum({&amp;lt;Activities= , EmpId={"=sum(HoursWorked)&amp;gt;0"}&amp;gt;} total &amp;lt;EmpName&amp;gt; HoursWorked)&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;,EmpName, &lt;STRONG&gt;Activities&lt;/STRONG&gt;))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;and it seems it is working. Please confirm if you agree. Also, if it is quick for you, any suggestion to implement the wage calculation into the script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 16:03:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264426#M495704</guid>
      <dc:creator />
      <dc:date>2012-02-08T16:03:43Z</dc:date>
    </item>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264427#M495705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding the pivot table dimension to the aggr() dimension list should do the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the script modification, could you upload your excel sample file here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 16:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264427#M495705</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-08T16:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264428#M495706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Here it is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 16:15:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264428#M495706</guid>
      <dc:creator />
      <dc:date>2012-02-08T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264429#M495707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Isn't there a second table missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 16:34:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264429#M495707</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-08T16:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Totals expression calculation issue</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264430#M495708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2012 16:36:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-expression-calculation-issue/m-p/264430#M495708</guid>
      <dc:creator />
      <dc:date>2012-02-08T16:36:10Z</dc:date>
    </item>
  </channel>
</rss>

