<?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 Creating a new field from the Sum of an existing field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283681#M1201782</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Tbl:&lt;BR /&gt;Load * inline&lt;BR /&gt;[Val, Type&lt;BR /&gt;0, A&lt;BR /&gt;100, A&lt;BR /&gt;1000, A&lt;BR /&gt;20, B&lt;BR /&gt;50, C&lt;BR /&gt;500, C&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;sum:&lt;BR /&gt;Load Type,&lt;BR /&gt; sum(Val) as Amount&lt;BR /&gt;Resident Tbl&lt;BR /&gt;Group by Type;&lt;BR /&gt;&lt;BR /&gt;// drop table Tbl;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Oct 2010 15:04:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-22T15:04:18Z</dc:date>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283679#M1201780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I'm new to QV and hope someone here can help me out &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have a table with two fields with this kind of structure:&lt;/P&gt;&lt;P&gt;Field1 - Field 2&lt;/P&gt;&lt;P&gt;10 - A&lt;BR /&gt;100 - A&lt;BR /&gt;1000 - A&lt;BR /&gt;20 - B&lt;BR /&gt;50 - C&lt;BR /&gt;500 - C&lt;/P&gt;&lt;P&gt;What I want to do is to take this information and create a new table with the sums of Field1 for represented for each Field2, like so:&lt;/P&gt;&lt;P&gt;1110 - A&lt;BR /&gt;20 - B&lt;BR /&gt;550 - C&lt;/P&gt;&lt;P&gt;I would like to do this in the script. What's the easiest way?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;/M&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 14:55:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283679#M1201780</guid>
      <dc:creator />
      <dc:date>2010-10-22T14:55:43Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283680#M1201781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Data:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Field1,Field2&lt;BR /&gt;10,A&lt;BR /&gt;100,A&lt;BR /&gt;1000,A&lt;BR /&gt;20,B&lt;BR /&gt;50,C&lt;BR /&gt;500,C&lt;BR /&gt;];&lt;BR /&gt;LOAD Field2, Sum(Field1) As Total RESIDENT Data&lt;BR /&gt;GROUP BY Field2;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:02:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283680#M1201781</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:02:10Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283681#M1201782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Tbl:&lt;BR /&gt;Load * inline&lt;BR /&gt;[Val, Type&lt;BR /&gt;0, A&lt;BR /&gt;100, A&lt;BR /&gt;1000, A&lt;BR /&gt;20, B&lt;BR /&gt;50, C&lt;BR /&gt;500, C&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;sum:&lt;BR /&gt;Load Type,&lt;BR /&gt; sum(Val) as Amount&lt;BR /&gt;Resident Tbl&lt;BR /&gt;Group by Type;&lt;BR /&gt;&lt;BR /&gt;// drop table Tbl;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283681#M1201782</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:04:18Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283682#M1201783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NMiller,&lt;/P&gt;&lt;P&gt;I am working hard, next time .... &lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt;&lt;/P&gt;&lt;P&gt;Many Regards&lt;/P&gt;&lt;P&gt;Roland&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:08:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283682#M1201783</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:08:29Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283683#M1201784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;And if I want to load the data from an external QVD file? I tried FROM at the end but can't get it to work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:09:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283683#M1201784</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:09:16Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283684#M1201785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;use the (file-) wizard to create your default load-statement and do the rest like grouping etc. manually.&lt;/P&gt;&lt;P&gt;Regards Roland&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:12:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283684#M1201785</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:12:11Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283685#M1201786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay thanks! Got that to work.&lt;/P&gt;&lt;P&gt;But I have one further question, a bit trickier I assume&lt;/P&gt;&lt;P&gt;I want to that on every row the sum of that row AND all previous rows should be in the field.&lt;/P&gt;&lt;P&gt;Using the above example that would mean:&lt;/P&gt;&lt;P&gt;A - 1110&lt;/P&gt;&lt;P&gt;B - 1130&lt;/P&gt;&lt;P&gt;c - 1680&lt;/P&gt;&lt;P&gt;How do I accomplish this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:25:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283685#M1201786</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:25:00Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283686#M1201787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;sorry, the weekend is waiting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:43:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283686#M1201787</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:43:05Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283687#M1201788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a bit of a guess, but try:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Data:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Field1,Field2&lt;BR /&gt;10,A&lt;BR /&gt;100,A&lt;BR /&gt;1000,A&lt;BR /&gt;20,B&lt;BR /&gt;50,C&lt;BR /&gt;500,C&lt;BR /&gt;];&lt;BR /&gt;Data2:&lt;BR /&gt;LOAD Field2, Sum(Field1) As Total RESIDENT Data&lt;BR /&gt;GROUP BY Field2;&lt;BR /&gt;Data3:&lt;BR /&gt;LOAD Field2, Total,&lt;BR /&gt;If(Previous(Total) &amp;gt; 0, Previous(Total), Total) As TempTotal&lt;BR /&gt;RESIDENT Data2;&lt;BR /&gt;Data4:&lt;BR /&gt;LOAD Field2,&lt;BR /&gt;If(Previous(Total) &amp;gt; 0, Previous(TempTotal) + Total, Total) As RunningTotal&lt;BR /&gt;RESIDENT Data3;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I tested it in a sample app, but I admit it is pretty ugly. There's probably a way to clean it up a bit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 15:45:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283687#M1201788</guid>
      <dc:creator />
      <dc:date>2010-10-22T15:45:22Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283688#M1201789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay yeah I understand how this works thanks! , but the actual table I'm using have thousands of rows &lt;IMG alt="Stick out tongue" src="http://community.qlik.com/emoticons/emotion-4.gif" /&gt; Maybe some sort of looping mechanism would do it? How can I accoplish this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Oct 2010 13:09:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283688#M1201789</guid>
      <dc:creator />
      <dc:date>2010-10-23T13:09:46Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283689#M1201790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;...to clarify somewhat: I have a table with two fields one date field and one balance field - there can be more than 1 rows per date with different balances for each row.&lt;/P&gt;&lt;P&gt;I want to create a new table where a row equals = the date field + the sum of all balance field for that date PLUS the sum of the balance fields for all previous dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Oct 2010 13:22:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283689#M1201790</guid>
      <dc:creator />
      <dc:date>2010-10-23T13:22:21Z</dc:date>
    </item>
    <item>
      <title>Creating a new field from the Sum of an existing field</title>
      <link>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283690#M1201791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mauich123,&lt;/P&gt;&lt;P&gt;I think you should open a new thread with your new question(s). This thread has the green checkbox for solved threads, not much people will therefor watch it.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Roland&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Oct 2010 22:08:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Creating-a-new-field-from-the-Sum-of-an-existing-field/m-p/283690#M1201791</guid>
      <dc:creator />
      <dc:date>2010-10-23T22:08:33Z</dc:date>
    </item>
  </channel>
</rss>

