<?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: multiply 2 fields from different tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832269#M1214659</link>
    <description>&lt;P&gt;Either join the fields from different tables into same table and then do multiplication, or create a mapping table for one of the 2 tables and use applymap.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table1:&lt;BR /&gt;load * inline [&lt;BR /&gt;dim1, value1&lt;BR /&gt;a, 10&lt;BR /&gt;b, 20&lt;BR /&gt;c, 30&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table2:&lt;BR /&gt;mapping load * inline [&lt;BR /&gt;dim2, value2&lt;BR /&gt;a, 50&lt;BR /&gt;b, 60&lt;BR /&gt;c, 70&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table3:&lt;BR /&gt;load&lt;BR /&gt;dim1 as dim3&lt;BR /&gt;,value1 * applymap('table2', dim1) as value3&lt;/P&gt;&lt;P&gt;resident table1;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stevejoyce_0-1630344507520.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60983iDECA42C351406932/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stevejoyce_0-1630344507520.png" alt="stevejoyce_0-1630344507520.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 17:28:37 GMT</pubDate>
    <dc:creator>stevejoyce</dc:creator>
    <dc:date>2021-08-30T17:28:37Z</dc:date>
    <item>
      <title>multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832260#M1214658</link>
      <description>&lt;P&gt;Hi there. How can I multiply 2 fields from different tables? Any Suggestions?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 16:58:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832260#M1214658</guid>
      <dc:creator>ELI4</dc:creator>
      <dc:date>2021-08-30T16:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832269#M1214659</link>
      <description>&lt;P&gt;Either join the fields from different tables into same table and then do multiplication, or create a mapping table for one of the 2 tables and use applymap.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table1:&lt;BR /&gt;load * inline [&lt;BR /&gt;dim1, value1&lt;BR /&gt;a, 10&lt;BR /&gt;b, 20&lt;BR /&gt;c, 30&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table2:&lt;BR /&gt;mapping load * inline [&lt;BR /&gt;dim2, value2&lt;BR /&gt;a, 50&lt;BR /&gt;b, 60&lt;BR /&gt;c, 70&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table3:&lt;BR /&gt;load&lt;BR /&gt;dim1 as dim3&lt;BR /&gt;,value1 * applymap('table2', dim1) as value3&lt;/P&gt;&lt;P&gt;resident table1;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stevejoyce_0-1630344507520.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60983iDECA42C351406932/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stevejoyce_0-1630344507520.png" alt="stevejoyce_0-1630344507520.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 17:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832269#M1214659</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-08-30T17:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832273#M1214660</link>
      <description>&lt;P&gt;Hi steve. thanks for answering. I used join to join the tables but when I want to do the multiplication, it does not recognize the field that I joined. why ?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 17:57:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832273#M1214660</guid>
      <dc:creator>ELI4</dc:creator>
      <dc:date>2021-08-30T17:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832274#M1214661</link>
      <description>&lt;P&gt;can you share your script code?&amp;nbsp; are you joining before you do multiplication, and not in the same statement?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 17:58:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832274#M1214661</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-08-30T17:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832278#M1214662</link>
      <description>&lt;LI-CODE lang="markup"&gt;Salesnews:
Load
    *,
    (Sales-CostPerUnit) as Benefit;
LOAD
    ItemID,
    Date,
    CampaignID,
    DocumentNumber,
    StoreHanut,
    "Time",
    SalesmanID,
    if( Quantity&amp;gt;= 0, 'Sold', 'Return' ) as Status,
    ApplyMap('CampaingID_Map', CampaignID , 'No Campaign' ) as NameofCampaign,
    TotalPriceBeforVat,
    Quantity,
    (TotalPriceBeforVat*Quantity*1.17) as Sales
FROM [lib://ExtractDB/Salesnews.qvd] (qvd);

left Join
Stock:
LOAD 
    ItemID,
    Cost as CostPerUnit
FROM [lib://ExtractDB/Stock.qvd]
(qvd);&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 30 Aug 2021 18:07:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832278#M1214662</guid>
      <dc:creator>ELI4</dc:creator>
      <dc:date>2021-08-30T18:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832287#M1214663</link>
      <description>&lt;P&gt;They only multiplication i see you doing is all from Salesnews.qvd so i'm not sure where your issue is.&amp;nbsp; Add Exit script; or step through with the debugger after your join and before your multiplication.&amp;nbsp; Make sure you have the right field name.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 18:23:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832287#M1214663</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-08-30T18:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832312#M1214665</link>
      <description>&lt;P&gt;When i want to do&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; (Sales-CostPerUnit) as Benefit;&lt;/LI-CODE&gt;&lt;P&gt;error appears:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Field 'CostPerUnit' not found&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 19:34:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832312#M1214665</guid>
      <dc:creator>ELI4</dc:creator>
      <dc:date>2021-08-30T19:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832317#M1214666</link>
      <description>&lt;P&gt;Yes, i believe you had another post open with same issue.&amp;nbsp; You are joining CostPerUnit AFTER you do this calculation.&amp;nbsp; So at the time you do&amp;nbsp;Sales-CostPerUnit, this field doesn't exist in that table yet.&amp;nbsp; I assume there is 1 CostPerUnit for each ItemID, so we can do mapping load for this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;map_ItemID_CostPerUnit:&lt;BR /&gt;mapping LOAD&lt;BR /&gt;ItemID,&lt;BR /&gt;Cost as CostPerUnit&lt;BR /&gt;FROM [lib://ExtractDB/Stock.qvd]&lt;BR /&gt;(qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Salesnews:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;(Sales-applymap('map_ItemID_CostPerUnit', ItemID)) as Benefit;&lt;BR /&gt;LOAD&lt;BR /&gt;ItemID,&lt;BR /&gt;Date,&lt;BR /&gt;CampaignID,&lt;BR /&gt;DocumentNumber,&lt;BR /&gt;StoreHanut,&lt;BR /&gt;"Time",&lt;BR /&gt;SalesmanID,&lt;BR /&gt;if( Quantity&amp;gt;= 0, 'Sold', 'Return' ) as Status,&lt;BR /&gt;ApplyMap('CampaingID_Map', CampaignID , 'No Campaign' ) as NameofCampaign,&lt;BR /&gt;TotalPriceBeforVat,&lt;BR /&gt;Quantity,&lt;BR /&gt;(TotalPriceBeforVat*Quantity*1.17) as Sales&lt;BR /&gt;FROM [lib://ExtractDB/Salesnews.qvd] (qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 20:04:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832317#M1214666</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-08-30T20:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832322#M1214667</link>
      <description>&lt;P&gt;8 hours with this. You're a genius!!!&lt;BR /&gt;THANK YOU THANK YOU THANK YOU&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 20:32:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832322#M1214667</guid>
      <dc:creator>ELI4</dc:creator>
      <dc:date>2021-08-30T20:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: multiply 2 fields from different tables</title>
      <link>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832327#M1214668</link>
      <description>&lt;P&gt;No problem, glad you have it resolved!&amp;nbsp; Please mark as solution so thread can be marked appropriately.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 20:46:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/multiply-2-fields-from-different-tables/m-p/1832327#M1214668</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-08-30T20:46:33Z</dc:date>
    </item>
  </channel>
</rss>

