<?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 not calculating correctly in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Totals-not-calculating-correctly/m-p/163276#M36436</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;sum(if(PeriodNum &amp;lt; vCurrentPeriodNum and Year = vCurrentYear, Sales, ForecastSales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Aug 2009 09:32:01 GMT</pubDate>
    <dc:creator>disqr_rm</dc:creator>
    <dc:date>2009-08-21T09:32:01Z</dc:date>
    <item>
      <title>Totals not calculating correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-not-calculating-correctly/m-p/163275#M36435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a formula that says if the month number (PeriodNum) is less than the current month number (as defined in a text box call vCurrentPeriodNum) then use the Actual Sales value else if the Month number =&amp;gt; current month number then use the forecast sales value. it looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;if(PeriodNum &amp;lt; vCurrentPeriodNum,sum(if(Year = vCurrentYear,(Sales))),sum(ForecastSales))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The Months are July = 1, Aug = 2 etc&lt;/P&gt;&lt;P&gt;This lets us define the current month and show actual sales for the months already completed and forecast sales for the upcoming months in a timeline.&lt;/P&gt;&lt;P&gt;There is also a section of the formula "Year = vCurrentYear" so that it knows to use the current years month number as the data has multiple years worth of data in it.&lt;/P&gt;&lt;P&gt;The problem is that I get the following result in the attached excel spreadsheet... [View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/6354.Qlikview-test.xls:550:0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The total for the forecast per the formula should be $15066 if you add the RF (Rolling Forecast) column totals but it returns $13531.&lt;/P&gt;&lt;P&gt;This is because as we are now in the financial period 2 (August), The July forecast amount of $866 has been replaced by the actual sales value of $2401(you can see that RF and Actual are the same) but the total is calculating off the forecast amount of $866.&lt;/P&gt;&lt;P&gt;i.e. $866 + $3415 + $9250 = $13531&lt;/P&gt;&lt;P&gt;Does anyone know of a way to get the totals to take the value in the cell?&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2009 07:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-not-calculating-correctly/m-p/163275#M36435</guid>
      <dc:creator />
      <dc:date>2009-08-21T07:16:56Z</dc:date>
    </item>
    <item>
      <title>Totals not calculating correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Totals-not-calculating-correctly/m-p/163276#M36436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;sum(if(PeriodNum &amp;lt; vCurrentPeriodNum and Year = vCurrentYear, Sales, ForecastSales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2009 09:32:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Totals-not-calculating-correctly/m-p/163276#M36436</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2009-08-21T09:32:01Z</dc:date>
    </item>
  </channel>
</rss>

