<?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 while loading and/or while displaying a graph in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209349#M64371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should probably point out some weaknesses of the separate month approach. First, performance. QlikView is essentially looping through the months, then pulling in ALL months of data to compare to each. That's a lot of work for it to be doing, and on large data sets, the report will be noticeably slow. It may perform just fine on smaller data sets. Second, ease of use issues. If you select the month from the report, you aren't selecting the real month, only the fake month. So while that report will change, no other reports will change. Even worse, if you select the real month, the chart will still show multiple months - every month of data that the one month of data will be accumulated into.&lt;/P&gt;&lt;P&gt;I think I have a third approach that handles it in the data model without actually doing accumulations ahead of time. I'll need to work it into the example, but it would be loosely based on the attached approach for showing a previous year's data. The basic idea is that every record has a unique ID, and then you create a table that joins one selected month to the actual records that span multiple months. If I can't get to it quickly, maybe you can work it out with that hint and the example file if the weaknesses of the separate month approach matter in your application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jan 2010 18:49:12 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-01-14T18:49:12Z</dc:date>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209344#M64366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi !&lt;BR /&gt;&lt;BR /&gt;I have some problems with the "set analysis" functions.&lt;BR /&gt;&lt;BR /&gt;I have a list of "sells" having a date and a value.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[CODE]&lt;BR /&gt;Sells:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Date, Value&lt;BR /&gt;2008-01-01, 10&lt;BR /&gt;2008-02-01, 20&lt;BR /&gt;2008-03-01, 30&lt;BR /&gt;2008-04-01, 40&lt;BR /&gt;2008-05-01, 50&lt;BR /&gt;2008-06-01, 60&lt;BR /&gt;2008-07-01, 70&lt;BR /&gt;2008-08-01, 80&lt;BR /&gt;2008-09-01, 90&lt;BR /&gt;2008-10-01, 100&lt;BR /&gt;2008-11-01, 110&lt;BR /&gt;2008-12-01, 120&lt;BR /&gt;2009-01-01, 130&lt;BR /&gt;2009-02-01, 140&lt;BR /&gt;2009-03-01, 150&lt;BR /&gt;2009-04-01, 160&lt;BR /&gt;];&lt;BR /&gt;[/CODE]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would like, for each line, to have 2 more values :&lt;BR /&gt;- the sum from the start of the year&lt;BR /&gt;- the sum from the 4 past months&lt;BR /&gt;&lt;BR /&gt;Expected values :&lt;BR /&gt;2008-01-01, 10 --&amp;gt; 10 | 10&lt;BR /&gt;2008-02-01, 20 --&amp;gt; 30 | 30&lt;BR /&gt;2008-03-01, 30 --&amp;gt; 60 | 60&lt;BR /&gt;2008-04-01, 40 --&amp;gt; 100 | 100&lt;BR /&gt;2008-05-01, 50 --&amp;gt; 150 | 140&lt;BR /&gt;2008-06-01, 60 --&amp;gt; 210 | 180&lt;BR /&gt;2008-07-01, 70 --&amp;gt; 280 | 220&lt;BR /&gt;2008-08-01, 80 --&amp;gt; 360 | 260&lt;BR /&gt;2008-09-01, 90 --&amp;gt; 450 | 300&lt;BR /&gt;2008-10-01, 100 --&amp;gt; 550 | 340&lt;BR /&gt;2008-11-01, 110 --&amp;gt; 660 | 380&lt;BR /&gt;2008-12-01, 120 --&amp;gt; 780 |420&lt;BR /&gt;2009-01-01, 130 --&amp;gt; 130 | 460&lt;BR /&gt;2009-02-01, 140 --&amp;gt; 270 | 500&lt;BR /&gt;2009-03-01, 150 --&amp;gt; 420 | 540&lt;BR /&gt;2009-04-01, 160 --&amp;gt; 580 | 580&lt;BR /&gt;&lt;BR /&gt;At first, I wanted to add dynamically this values while loading, to be able to play with this values as axis.&lt;BR /&gt;&lt;BR /&gt;Here is my first problem : I don't know how to use the "SUM" function in the "LOAD" section.&lt;BR /&gt;Is it at least possible ?&lt;BR /&gt;&lt;BR /&gt;(I can use the "peek" function, but it not helps for what I want to do...)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Next, I tryied to calculate those values "on the fly".&lt;BR /&gt;I've created a simple table (graph), in wich I set "Date" as dimension, and "=Value" as expression.&lt;BR /&gt;I want a to add another expression that says "the sum of Values in the lines having the same year" and onther one that says "the sum of Values from the 4 past months".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I added a field "Year" in my load :&lt;BR /&gt;[CODE]&lt;BR /&gt;Sells2:&lt;BR /&gt;LOAD *,&lt;BR /&gt;left(Date, 4) AS [Year]&lt;BR /&gt;RESIDENT Sells&lt;BR /&gt;ORDER BY Date;&lt;BR /&gt;[/CODE]&lt;BR /&gt;&lt;BR /&gt;If I add&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;=sum({$&amp;lt;Year&amp;lt;={"2008"}&amp;gt;} Value)&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I have the expected values, but only for the year "2008" (obviously).&lt;BR /&gt;&lt;BR /&gt;I would like to say&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;=sum({$&amp;lt;Year&amp;lt;={THE_YEAR_CORRESPONDING_TO_THE_YEAR_OF_THIS_LINE}&amp;gt;} Value)&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;but I don't know what "THE_YEAR_CORRESPONDING_TO_THE_YEAR_OF_THIS_LINE" should be ?!?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Can anybody help me on how to do this (for the "from the start of the year" and for the "from the 4 last month") ?&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 17:47:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209344#M64366</guid>
      <dc:creator />
      <dc:date>2010-01-12T17:47:14Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209345#M64367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got the Sum(Value) per year while loading&lt;/P&gt;&lt;P&gt;Not the most elegant script, but it works &lt;IMG alt="Wink" src="http://community.qlik.com/emoticons/emotion-5.gif" /&gt;&lt;/P&gt;&lt;P&gt;The other part is more work. Perhaps I can set aside some time tomorrow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jan 2010 21:00:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209345#M64367</guid>
      <dc:creator />
      <dc:date>2010-01-12T21:00:03Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209346#M64368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Got the Sum(Value) per year while loading&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me the sum for the whole year.&lt;/P&gt;&lt;P&gt;The value I want is "the sum from the begining of the year to the current date".&lt;/P&gt;&lt;P&gt;IE :&lt;/P&gt;&lt;P&gt;For the January 2008 month, I want "values of Jan 2008".&lt;BR /&gt;For the February 2008 month, I want "values of Jan 2008 + values of Feb 2008".&lt;BR /&gt;For the March 2008 month, I want "values of Jan 2008 + values of Feb 2008 + values of Mar 2008".&lt;BR /&gt;...&lt;BR /&gt;For the Decembre 2008 month, I want "values of Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec 2008".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I can set aside some time tomorrow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2010 10:02:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209346#M64368</guid>
      <dc:creator />
      <dc:date>2010-01-13T10:02:34Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209347#M64369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, there's no such thing as THE_YEAR_CORRESPONDING_TO_THE_YEAR_OF_THIS_LINE in set analysis. Set analysis is performed ONCE for the entire chart. You can't define a separate set of data for each line of the chart, which is what you're trying to do here.&lt;/P&gt;&lt;P&gt;Here are two approaches. The first approach does the accumulation in the script. I'm not happy with the four month accumulation, since it assumes you only have one record per month. The YTD logic is more robust. Both fields required that the records be in ascending order by date. The second approach does the accumulation in the chart. It uses a month completely separated from your main data set as the dimension, and then uses IF statements to sum the correct months for each row of the chart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2010 21:54:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209347#M64369</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-01-13T21:54:56Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209348#M64370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for this answer.&lt;/P&gt;&lt;P&gt;It shows me exactly what I wanted to do.&lt;/P&gt;&lt;P&gt;I hadn't though to use a "IslandMonth" table to have a separated list of UNIQUE months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 10:37:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209348#M64370</guid>
      <dc:creator />
      <dc:date>2010-01-14T10:37:19Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209349#M64371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should probably point out some weaknesses of the separate month approach. First, performance. QlikView is essentially looping through the months, then pulling in ALL months of data to compare to each. That's a lot of work for it to be doing, and on large data sets, the report will be noticeably slow. It may perform just fine on smaller data sets. Second, ease of use issues. If you select the month from the report, you aren't selecting the real month, only the fake month. So while that report will change, no other reports will change. Even worse, if you select the real month, the chart will still show multiple months - every month of data that the one month of data will be accumulated into.&lt;/P&gt;&lt;P&gt;I think I have a third approach that handles it in the data model without actually doing accumulations ahead of time. I'll need to work it into the example, but it would be loosely based on the attached approach for showing a previous year's data. The basic idea is that every record has a unique ID, and then you create a table that joins one selected month to the actual records that span multiple months. If I can't get to it quickly, maybe you can work it out with that hint and the example file if the weaknesses of the separate month approach matter in your application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 18:49:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209349#M64371</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-01-14T18:49:12Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209350#M64372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's the original example extended to use the linkage table approach. Using FOR loops is probably the most efficient from a memory point of view, but there's probably a much faster approach using JOIN. I've replaced FOR loops in the past with JOINS because time to load has been more critical around here than memory use. But that's really a separate issue, so I'm leaving it as is since it appears to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2010 19:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209350#M64372</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-01-14T19:32:54Z</dc:date>
    </item>
    <item>
      <title>SUM while loading and/or while displaying a graph</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209351#M64373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for this alternative method.&lt;/P&gt;&lt;P&gt;It seems to be really efficient &lt;IMG alt="Yes" src="http://community.qlik.com/emoticons/emotion-21.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jan 2010 11:15:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-while-loading-and-or-while-displaying-a-graph/m-p/209351#M64373</guid>
      <dc:creator />
      <dc:date>2010-01-15T11:15:23Z</dc:date>
    </item>
  </channel>
</rss>

