<?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: SUM with filters in a LOAD script? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947991#M1219632</link>
    <description>&lt;P&gt;Use a Where clause in the Load.&lt;/P&gt;
&lt;P&gt;LOAD&lt;BR /&gt;Sum(CANTIDAD_TOTAL) as CANTIDAD_SAP,&lt;BR /&gt;ID_TYPO2,&lt;BR /&gt;From ...&lt;BR /&gt;Where ID_TIPO = 'SAP'&lt;BR /&gt;Group By ID_TYP02,...&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 16:00:24 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2022-06-24T16:00:24Z</dc:date>
    <item>
      <title>SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947804#M1219626</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;So I have a table in which I want to do a sum to a dimension but with one filter lets say, so for example, i want to sum quantity of products when this other dimension from the same load script is equal to "AS", I know how to sum that in expressions in a table but when I put this expression in the load script it doesnt eat it:&lt;/P&gt;
&lt;P&gt;Here it is on a graph (pivot table):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_0-1656062785152.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82574iB83C0BB0FC2CE127/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_0-1656062785152.png" alt="DiegoFraj_0-1656062785152.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I want this calculated field to be in my load:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_1-1656062886008.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/82575i3B3AE6FE6B6AD519/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_1-1656062886008.png" alt="DiegoFraj_1-1656062886008.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I achieve this? Also, I need to do another one with differente ID_TIPO and then take these two calculated dimensions and operate with them (one minus the other one), all in the load script, because I want to store into a qvd.&lt;/P&gt;
&lt;P&gt;And yes, I know you can store the pivot table with its data if you click on the table and export it but I need to do it in a load script so it stores it automatically if I program a task, so I don´t have to export manually each time I want to refresh the data&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 09:31:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947804#M1219626</guid>
      <dc:creator>Diego_780</dc:creator>
      <dc:date>2022-06-24T09:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947861#M1219627</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Try with:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD
if(ID_TYPO='SAP',CANTIDAD_TOTAL,0) as CANTIDAD_SAP,
ID_TYPO,
ID_TYPO2,
...&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 11:28:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947861#M1219627</guid>
      <dc:creator>sergio0592</dc:creator>
      <dc:date>2022-06-24T11:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947991#M1219632</link>
      <description>&lt;P&gt;Use a Where clause in the Load.&lt;/P&gt;
&lt;P&gt;LOAD&lt;BR /&gt;Sum(CANTIDAD_TOTAL) as CANTIDAD_SAP,&lt;BR /&gt;ID_TYPO2,&lt;BR /&gt;From ...&lt;BR /&gt;Where ID_TIPO = 'SAP'&lt;BR /&gt;Group By ID_TYP02,...&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:00:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1947991#M1219632</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-06-24T16:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1953931#M1219844</link>
      <description>&lt;P&gt;I'm trying it with your code but I can´t achieve what I really want, so I have this on the pivot table with this expressions for each type:&amp;nbsp;SUM({&amp;lt;ID_TIPO = {"SAP"}&amp;gt;} CANTIDAD_TOTAL) or&amp;nbsp;SUM({&amp;lt;ID_TIPO = {"VISUAL"}&amp;gt;} CANTIDAD_TOTAL) and in the pivto table it shows like this, in ONE line:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_0-1657536887436.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/83776i79A87295ECD6ECE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_0-1657536887436.png" alt="DiegoFraj_0-1657536887436.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I´ve tried this code for a normal table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_1-1657537034615.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/83777i47A4BC06A4944B20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_1-1657537034615.png" alt="DiegoFraj_1-1657537034615.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But the result is this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_2-1657537057346.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/83778i3FA1A831A206D965/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_2-1657537057346.png" alt="DiegoFraj_2-1657537057346.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;How can I get both values in the same line?? They have everything in common unless the ID_TYPE, that one is 'SAP' and the other 'VISUAL' but I thought that by using JOIN it would merge into one.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 10:58:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1953931#M1219844</guid>
      <dc:creator>Diego_780</dc:creator>
      <dc:date>2022-07-11T10:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1954073#M1219849</link>
      <description>&lt;P&gt;Your rows will not merge in a Join because ID_TIPO values are different. You should be able to create both fields in a single load like:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sum(if(ID_TIPO = 'SAP', CANTIDAD_TOTAL, 0) as CANTIDAD_SAP,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Sum(if(ID_TIPO = 'VISUAL', CANTIDAD_VISUAL, 0) as CANTIDAD_VISUAL,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And remove ID_TIPO from the LOAD and the GROUP BY.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 14:08:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1954073#M1219849</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-07-11T14:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: SUM with filters in a LOAD script?</title>
      <link>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1954419#M1219857</link>
      <description>&lt;P&gt;Thanks for the answer! It finally worked, but I had to remove another value, in this case CANTIDAD_TOTAL (Total quantity) because it was different so it was making me the split, I had to remove if from the LOAD and the Group By aswell. Now it works fine thanks, also had to do a minus between both values and no problem, I just used the minus symbol in between and name it a new value:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum(If(ID_TIPO='SAP', CANTIDAD_TOTAL,0)) - Sum(If(ID_TIPO='VISUAL', CANTIDAD_TOTAL,0)) as DESCUADRE2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DiegoFraj_0-1657613807993.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/83887i0CD5B84BC48E352B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DiegoFraj_0-1657613807993.png" alt="DiegoFraj_0-1657613807993.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thanks for the help folks!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 08:17:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SUM-with-filters-in-a-LOAD-script/m-p/1954419#M1219857</guid>
      <dc:creator>Diego_780</dc:creator>
      <dc:date>2022-07-12T08:17:18Z</dc:date>
    </item>
  </channel>
</rss>

