<?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 Calculating percentage using data from two different tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-percentage-using-data-from-two-different-tables/m-p/323171#M1196562</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If I understand correctly then QlikView will probably join the two tables on the same column name. What you may want to do is put something into your script when you are loading the tables to say which table it is from. For example:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;'TableA' as SourceTable;&lt;/P&gt;&lt;P&gt;from ...&lt;/P&gt;&lt;P&gt;This way you can distinguish between the two tables.&lt;/P&gt;&lt;P&gt;Then your expression would be something like:&lt;/P&gt;&lt;P&gt;sum ({&amp;lt;SourceTable={'TableA'}&amp;gt;} "Total Hours") / sum ({&amp;lt;SourceTable={'TableB'}&amp;gt;} "Total Hours")&lt;/P&gt;&lt;P&gt;I'm not sure how familiar you are with Set Analysis but I think it is supposed to be quicker than using IF statements.&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Apr 2011 12:18:43 GMT</pubDate>
    <dc:creator>chris_johnson</dc:creator>
    <dc:date>2011-04-21T12:18:43Z</dc:date>
    <item>
      <title>Calculating percentage using data from two different tables</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-percentage-using-data-from-two-different-tables/m-p/323170#M1196561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have inserted data from two different tables of SQL in a Qlikview file. I want to calculate percentage by using data from both these table which contains same columns.&lt;/P&gt;&lt;P&gt;Example: There are some hours in Column1 of Table A&lt;/P&gt;&lt;P&gt;There are some hours in Column1 of Table B and Column name is Same as Table A&lt;/P&gt;&lt;P&gt;I want to divide hours of Table A by Hours from Table B but I am not getting correct percentage.&lt;/P&gt;&lt;P&gt;Can anyone please help with Formula?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Apr 2011 11:08:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-percentage-using-data-from-two-different-tables/m-p/323170#M1196561</guid>
      <dc:creator />
      <dc:date>2011-04-21T11:08:38Z</dc:date>
    </item>
    <item>
      <title>Calculating percentage using data from two different tables</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-percentage-using-data-from-two-different-tables/m-p/323171#M1196562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If I understand correctly then QlikView will probably join the two tables on the same column name. What you may want to do is put something into your script when you are loading the tables to say which table it is from. For example:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;'TableA' as SourceTable;&lt;/P&gt;&lt;P&gt;from ...&lt;/P&gt;&lt;P&gt;This way you can distinguish between the two tables.&lt;/P&gt;&lt;P&gt;Then your expression would be something like:&lt;/P&gt;&lt;P&gt;sum ({&amp;lt;SourceTable={'TableA'}&amp;gt;} "Total Hours") / sum ({&amp;lt;SourceTable={'TableB'}&amp;gt;} "Total Hours")&lt;/P&gt;&lt;P&gt;I'm not sure how familiar you are with Set Analysis but I think it is supposed to be quicker than using IF statements.&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Apr 2011 12:18:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-percentage-using-data-from-two-different-tables/m-p/323171#M1196562</guid>
      <dc:creator>chris_johnson</dc:creator>
      <dc:date>2011-04-21T12:18:43Z</dc:date>
    </item>
  </channel>
</rss>

