<?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: Calculation in line chart not totaling up correctly in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculation-in-line-chart-not-totaling-up-correctly/m-p/1344333#M836313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out what I need to do.&amp;nbsp; For anyone in the future who might need this answer I had to sum up each by themselves. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;round(sum({&amp;lt;FileDate = &amp;gt;}[Total Distance Miles]) / sum({&amp;lt;FileDate = &amp;gt;}Seatbelt))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 May 2017 12:45:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-05-26T12:45:46Z</dc:date>
    <item>
      <title>Calculation in line chart not totaling up correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-line-chart-not-totaling-up-correctly/m-p/1344332#M836312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 5 different charts with different calculations that when I am just looking at 1 customer the number is correct but when I look at total company it is not correct.&amp;nbsp; I will give 1 chart as 1 example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In one of the charts I am trying to calculate the seatbelt exceptions.&lt;/P&gt;&lt;P&gt;So in the line chart it is by date for the dimensions and for the expression I first tried this calculation and I was not getting any of the correct&amp;nbsp; calculations for 1 customer on one date or correct calculations for total company.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the calculation should give me (if I could get it correct) on date 6/5/2017&amp;nbsp; 1 customer (customer number 2) 3663 and for total company on that date it should give me 9963.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try 1:&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;STRONG&gt;&lt;EM&gt;round(Sum({&amp;lt;FileDate = &amp;gt;}([Total Distance Miles] / Seatbelt)))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This gave me 1 customer = 896 and total company = 22088&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try2:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next I have tried doing the calculation in the script.&lt;/P&gt;&lt;P&gt;So something like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;if((S10 + HB + SB + HA)=0,0,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;round(TDM / SB) as SeatBeltS;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Sum ([Total Distance Miles]) as TDM,&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Sum (Seatbelt) as SB&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Resident Scorecard;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then I did this for the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Sum({&amp;lt;FileDate = &amp;gt;}(SeatBeltS))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This gave me for 1 customer = 3663&amp;nbsp; (which is correct) but for total company = 58494 (which is wrong) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not know what I need to do to get the total company to show the correct number?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-line-chart-not-totaling-up-correctly/m-p/1344332#M836312</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation in line chart not totaling up correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-line-chart-not-totaling-up-correctly/m-p/1344333#M836313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out what I need to do.&amp;nbsp; For anyone in the future who might need this answer I had to sum up each by themselves. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;round(sum({&amp;lt;FileDate = &amp;gt;}[Total Distance Miles]) / sum({&amp;lt;FileDate = &amp;gt;}Seatbelt))&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 12:45:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-line-chart-not-totaling-up-correctly/m-p/1344333#M836313</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-26T12:45:46Z</dc:date>
    </item>
  </channel>
</rss>

