<?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: Totals in Pivot Tables vs Straight Tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376452#M140332</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to get the "Avg Daily Compliance" in a Pivot table, you'll need to use aggr() in your expression. For an&amp;nbsp; explanation of totals in Pivot vs Straight, search the QV Help index for "aggr" and then click the link "Sum of Rows in Pivot Table". Your situation is similar to the example. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your aggr expression would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg(&lt;/P&gt;&lt;P&gt;aggr(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;((((SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHSECOUTOFADHERENCE)/60) - (SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHEXCUSEDLENGTH)/60))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, Employee, Date&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Aug 2012 03:26:40 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2012-08-09T03:26:40Z</dc:date>
    <item>
      <title>Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376447#M140327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping that someone could explain the difference how totals are calculated in a pivot table vs a staight table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression: &lt;SPAN style="font-size: 8pt;"&gt;((((SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHSECOUTOFADHERENCE)/60) - (SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHEXCUSEDLENGTH)/60))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Okay so I have three examples. When I use the above expression in a pivot able I get a total that looks to be an average although I am summing everything. When I switch to a straight table I get the same total but I later realized that when I just so happen to export to Excel and performed an average there that the totals were different. I then realized that I can get the same total as excel when I changed the total mode to average of rows. Great! BUT I lose the functionality of a pivot table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone tell me what is happening here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pivot Table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="19600" class="jive-image" alt="pivottable.png" src="https://community.qlik.com/legacyfs/online/19600_pivottable.png" /&gt;&lt;/P&gt;&lt;P&gt;Straight Table: Total Mode Expression&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="19608" class="jive-image" alt="straighttable_expression total.png" src="/legacyfs/online/19608_straighttable_expression total.png" /&gt;&lt;/P&gt;&lt;P&gt;Straight Tables: Total Mode: Average of Totals&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="19607" class="jive-image" alt="straighttable_avg of rows.png" src="/legacyfs/online/19607_straighttable_avg of rows.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2012 23:39:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376447#M140327</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-08-08T23:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376448#M140328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The number 90.75 is Esxpression Total - as I can see it is the same in Pivot and Straight tables.&lt;/P&gt;&lt;P&gt;The number 90.65 is average of rows.&lt;/P&gt;&lt;P&gt;In the first case, the expression is calculated over all data, ignoring Dimenasions.&amp;nbsp; In the second case, it is first calculated over dimensions, and after that the average is calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you ask what result is correct, the answer is&amp;nbsp; - it depends on what you're looking fore.&amp;nbsp; In most cases "Expression Total" makes more sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 00:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376448#M140328</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-09T00:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376449#M140329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you that makes perfect sense. One quick follow up question. You said that one makes more sense then the other. In my example I am showing adherence for an employee for a week. How would you explain the use of one over the other to a group of users?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 01:27:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376449#M140329</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-08-09T01:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376450#M140330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I said that the expression total makes more sense, I qualified it with "in most cases".&amp;nbsp; I can't tell for sure if this is your case too, maybe in your situation "avg of total" is better.&lt;/P&gt;&lt;P&gt;This sort of "discrepancy" is better to explain with an example from your actual data, starting from the numbers that are included in sum.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 01:49:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376450#M140330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-09T01:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376451#M140331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Understandable. I appreciate your input. Now if I could just keep the functionality of the pivot table while still getting the average of totals I will be in business. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 01:56:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376451#M140331</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-08-09T01:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376452#M140332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to get the "Avg Daily Compliance" in a Pivot table, you'll need to use aggr() in your expression. For an&amp;nbsp; explanation of totals in Pivot vs Straight, search the QV Help index for "aggr" and then click the link "Sum of Rows in Pivot Table". Your situation is similar to the example. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your aggr expression would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg(&lt;/P&gt;&lt;P&gt;aggr(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;((((SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHSECOUTOFADHERENCE)/60) - (SUM({&amp;lt;STATUSKEY = &amp;gt;}ADHEXCUSEDLENGTH)/60))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, Employee, Date&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 03:26:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376452#M140332</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2012-08-09T03:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376453#M140333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #632423; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; mso-bidi-font-family: &amp;amp;quot;Times New Roman&amp;amp;quot;; mso-bidi-theme-font: minor-bidi; mso-themecolor: accent2; mso-themeshade: 128;"&gt;Yes Rob, the “overarching” expression, (in this case average aggregated by Employee and Date) calculated over all data, returns the same result as in Excel.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #632423; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; mso-bidi-font-family: &amp;amp;quot;Times New Roman&amp;amp;quot;; mso-bidi-theme-font: minor-bidi; mso-themecolor: accent2; mso-themeshade: 128;"&gt;Villegasi03, feel free to take “Correct Answer” from me and give it to Rob – I only explained the difference, while Rob modified the expression for your needs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #632423; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; mso-bidi-font-family: &amp;amp;quot;Times New Roman&amp;amp;quot;; mso-bidi-theme-font: minor-bidi; mso-themecolor: accent2; mso-themeshade: 128;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #632423; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; mso-bidi-font-family: &amp;amp;quot;Times New Roman&amp;amp;quot;; mso-bidi-theme-font: minor-bidi; mso-themecolor: accent2; mso-themeshade: 128;"&gt;Michael&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 12:08:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376453#M140333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-09T12:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Totals in Pivot Tables vs Straight Tables</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376454#M140334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your assistance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and Michael thank you again for yours. Everything provided was very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 16:31:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-in-Pivot-Tables-vs-Straight-Tables/m-p/376454#M140334</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-08-09T16:31:37Z</dc:date>
    </item>
  </channel>
</rss>

