<?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 Calculation in the Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371317#M1178461</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorted it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;needed to use RESIDENT and not FROM....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2012 15:10:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-27T15:10:14Z</dc:date>
    <item>
      <title>Calculation in the Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371313#M1178454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I load sales data by Transaction from one file,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transaction No.&lt;/P&gt;&lt;P&gt;Product Name&lt;/P&gt;&lt;P&gt;Barcode&lt;/P&gt;&lt;P&gt;Product Category&lt;/P&gt;&lt;P&gt;Qty&lt;/P&gt;&lt;P&gt;Sales&lt;/P&gt;&lt;P&gt;GM&lt;/P&gt;&lt;P&gt;etc etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But some products are measured by tonnage so I need to multiply the Qty by a field called Multiplier which I load from a different file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently use an expression to do this, Qty * Multiplier&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works in my Straight Table when Barcode is the dimension&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I use category as the dimension the expression returns an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I am wondering if I can do a calculation in the load script to make a new field called Calculated Tonnage which would be Qty * Multiplier (Qty from the Sales Table, and Multiplier from the Multiplier Table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be greatly appreciated,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:01:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371313#M1178454</guid>
      <dc:creator />
      <dc:date>2012-03-27T11:01:09Z</dc:date>
    </item>
    <item>
      <title>Calculation in the Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371314#M1178456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans-serif; line-height: 18px; text-align: -webkit-auto; background-color: #ffffff;"&gt;Hello Ben, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, sans-serif; line-height: 18px; text-align: -webkit-auto; background-color: #ffffff;"&gt;If I understand what you want, you can do a left join between two tables and put the field multiplication as a new field in the sales table. Read this query again as Resident and create a new field by multiplying the desired field by field multiplication.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 18px; text-align: -webkit-auto; background-color: #ffffff; font-family: arial, sans-serif;"&gt;Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 18px; text-align: -webkit-auto; background-color: #ffffff; font-family: arial, sans-serif;"&gt;God Bless You!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 18px; text-align: -webkit-auto; background-color: #ffffff; font-family: arial, sans-serif;"&gt;Stive&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 18px; text-align: -webkit-auto; background-color: #ffffff; font-family: arial, sans-serif;"&gt;Brasil&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:37:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371314#M1178456</guid>
      <dc:creator />
      <dc:date>2012-03-27T11:37:58Z</dc:date>
    </item>
    <item>
      <title>Calculation in the Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371315#M1178458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you can do is a left join to the table containing the multiplier or a mapping load, in order to get the multiplier into your transactions table for the calculation.&lt;/P&gt;&lt;P&gt;As i understood, the barcode is a key field so you can do like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Map_Multiplier:&lt;/P&gt;&lt;P&gt;//this table will be automatically dropped after script execution as the load is preceded by mapping&lt;/P&gt;&lt;P&gt;Mapping Load Distinct Barcode, Multiplier&lt;/P&gt;&lt;P&gt;From multiplier_table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transactions:&lt;/P&gt;&lt;P&gt;Load Barcode,&lt;/P&gt;&lt;P&gt;Qty,&lt;/P&gt;&lt;P&gt;Qty * ApplyMap('Map_Multiplier', Barcode) as CalculatedTonnage&lt;/P&gt;&lt;P&gt;from transactions_table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example2:&lt;/P&gt;&lt;P&gt;tempTransactions:&lt;/P&gt;&lt;P&gt;Load Barcode,&lt;/P&gt;&lt;P&gt;Qty&lt;/P&gt;&lt;P&gt;From transactions_table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load Distinct Barcode,&lt;/P&gt;&lt;P&gt;Multiplier&lt;/P&gt;&lt;P&gt;From multiplier_table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transactions:&lt;/P&gt;&lt;P&gt;Load *, &lt;/P&gt;&lt;P&gt;Qty * Multiplier as CalculatedTonnage&lt;/P&gt;&lt;P&gt;Resident tempTransactions;&lt;/P&gt;&lt;P&gt;drop table tempTransactions;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:39:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371315#M1178458</guid>
      <dc:creator />
      <dc:date>2012-03-27T11:39:11Z</dc:date>
    </item>
    <item>
      <title>Calculation in the Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371316#M1178460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried example 2, ran into a problem though.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get my information from several different files (2010 Q1, 2010 Q2, 2010 Q3, 2010 Q4, 2011 Q1, 2012 Q1 etc), in the table viewer it puts all the Sales data into a table called 2010 Q1, but when I put in From [2010 Q1]; it just says can't find the table in the folder where I have the Qlikview file saved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 13:31:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371316#M1178460</guid>
      <dc:creator />
      <dc:date>2012-03-27T13:31:34Z</dc:date>
    </item>
    <item>
      <title>Calculation in the Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371317#M1178461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorted it!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;needed to use RESIDENT and not FROM....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ben.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 15:10:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-in-the-Load-Script/m-p/371317#M1178461</guid>
      <dc:creator />
      <dc:date>2012-03-27T15:10:14Z</dc:date>
    </item>
  </channel>
</rss>

