<?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: Calculating a field in a table based on another table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526924#M196932</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it helps I would like to do something like this (psuedocode):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR EACH Goal:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR EACH Invoice WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubField(Invoice.Key,'|',2) = SubField(Goal.Key,'|',2):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASSIGN Goal.InvoiceUnits += Invoice.Units;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END.&lt;/P&gt;&lt;P&gt;END.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Nov 2013 15:10:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-14T15:10:25Z</dc:date>
    <item>
      <title>Calculating a field in a table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526921#M196929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see my attached QVW.&amp;nbsp; In this file I have two fact tables - Invoices and Goals.&amp;nbsp; There is one dimension table - Products.&amp;nbsp; These are joined using the Lookup table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During load I want to calculate the number of units of a goal that has been completed.&amp;nbsp; This is calculated as the number of units on invoices for a specific product.&amp;nbsp; I want to store this as a new field called Goals.InvoiceUnits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My final goals table in the QVW would look like this (bold is the new field):&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="124" style="border: 1px solid #000000; width: 442px; height: 113px;" width="440"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Goal.ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Product.Code&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Product.Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Goal.Units&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Goal.InvoiceUnits&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Pint Glass&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Silverware&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Notebook&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;E&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Oatmeal&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 14:46:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526921#M196929</guid>
      <dc:creator />
      <dc:date>2013-11-14T14:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field in a table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526922#M196930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Ken&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not flatten your data into a single table and whack in a simple pivot table to show your required data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Bill&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526922#M196930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-11-14T15:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field in a table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526923#M196931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Bill,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example file this might make sense.&amp;nbsp; However the document I'm creating is much more complex - I have about 10 fact tables and 10 dimensions.&amp;nbsp; Flattening the data is not an option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:08:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526923#M196931</guid>
      <dc:creator />
      <dc:date>2013-11-14T15:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field in a table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526924#M196932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it helps I would like to do something like this (psuedocode):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR EACH Goal:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR EACH Invoice WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubField(Invoice.Key,'|',2) = SubField(Goal.Key,'|',2):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASSIGN Goal.InvoiceUnits += Invoice.Units;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END.&lt;/P&gt;&lt;P&gt;END.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:10:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526924#M196932</guid>
      <dc:creator />
      <dc:date>2013-11-14T15:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field in a table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526925#M196933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another problem with this is that a single invoice line could fufill multiple goals.&amp;nbsp; This case is not represented in my example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:12:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-a-field-in-a-table-based-on-another-table/m-p/526925#M196933</guid>
      <dc:creator />
      <dc:date>2013-11-14T15:12:02Z</dc:date>
    </item>
  </channel>
</rss>

