<?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 How to compare data between certain tables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-compare-data-between-certain-tables/m-p/302147#M711942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have to make dashboard for a production site&lt;/P&gt;&lt;P&gt;There is a table called ld_det which is having the details for different locations say for eg&lt;BR /&gt;at location pitsburg 50 nut bolts(spare part) were sold on 12th June 2011"&lt;/P&gt;&lt;P&gt;Now there is another table tr_hist which is having details of each transaction&lt;BR /&gt;like on 12th June&amp;nbsp; 2011 following transaction was done for nut bolt&lt;/P&gt;&lt;P&gt;10 at 12:00pm for site pitsburg&lt;BR /&gt;10 at 1:00 pm for site pitsburg&lt;BR /&gt;....&lt;BR /&gt;so on.&lt;/P&gt;&lt;P&gt;Now we are genrating a report that will show elapsed time &lt;/P&gt;&lt;P&gt;what is elapsed time?&lt;/P&gt;&lt;P&gt;Suppose if order has been taken by production site and spare part is not available at that particular but they know it will be available before the delivery date.&lt;BR /&gt;so the time and date of that particular transaction is elapsed time.&lt;/P&gt;&lt;P&gt;for example there were 50 nut bolts available on production site and order was taken for 70 nut bolts &lt;/P&gt;&lt;P&gt;so the time of transaction when it crossed 50 is called elapsed time&lt;/P&gt;&lt;P&gt;so considering the above example&lt;BR /&gt;suppose in ld_det on 12th june 2011 for pitsburg production site there were 5 coresponding rows in tr_hist.&lt;/P&gt;&lt;P&gt;So I will write the query in SQl as following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select l.ld_det_name, l.ld_det_spare, l.ld_det_date, elapsed_time(l.ld_date) from ld_det l&amp;nbsp; inner join &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;tr_hist t on l.ld_date = t.tr_date where elapsed_time(l.ld_date) &amp;lt;&amp;gt; 0&lt;BR /&gt;&amp;nbsp; where elapsed_time can be a subroutine/function/procedure&lt;BR /&gt;which will calculate based on following logic&lt;P&gt;&lt;/P&gt;&lt;P&gt;x number;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for eacr row in ld_det &lt;/P&gt;&lt;P&gt;x = ld_tranc&lt;/P&gt;&lt;P&gt;for each row in tr_hist where tr_part = ld_part and tr_date = ld_date&lt;/P&gt;&lt;P&gt;if x &amp;gt; 0 &lt;BR /&gt;x = x - tr_tran &lt;/P&gt;&lt;P&gt;if x &amp;lt; 0 the &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return tr_time&lt;/P&gt;&lt;P&gt;exit&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt;next row of tr_hist&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end loop1&lt;BR /&gt;end loop2&lt;/P&gt;&lt;P&gt;return 0&lt;BR /&gt;end fucntion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest regarding the issue ASAP &lt;/P&gt;&lt;P&gt;thanks in advance!!!!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jun 2011 11:30:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-06-20T11:30:42Z</dc:date>
    <item>
      <title>How to compare data between certain tables</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-compare-data-between-certain-tables/m-p/302147#M711942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have to make dashboard for a production site&lt;/P&gt;&lt;P&gt;There is a table called ld_det which is having the details for different locations say for eg&lt;BR /&gt;at location pitsburg 50 nut bolts(spare part) were sold on 12th June 2011"&lt;/P&gt;&lt;P&gt;Now there is another table tr_hist which is having details of each transaction&lt;BR /&gt;like on 12th June&amp;nbsp; 2011 following transaction was done for nut bolt&lt;/P&gt;&lt;P&gt;10 at 12:00pm for site pitsburg&lt;BR /&gt;10 at 1:00 pm for site pitsburg&lt;BR /&gt;....&lt;BR /&gt;so on.&lt;/P&gt;&lt;P&gt;Now we are genrating a report that will show elapsed time &lt;/P&gt;&lt;P&gt;what is elapsed time?&lt;/P&gt;&lt;P&gt;Suppose if order has been taken by production site and spare part is not available at that particular but they know it will be available before the delivery date.&lt;BR /&gt;so the time and date of that particular transaction is elapsed time.&lt;/P&gt;&lt;P&gt;for example there were 50 nut bolts available on production site and order was taken for 70 nut bolts &lt;/P&gt;&lt;P&gt;so the time of transaction when it crossed 50 is called elapsed time&lt;/P&gt;&lt;P&gt;so considering the above example&lt;BR /&gt;suppose in ld_det on 12th june 2011 for pitsburg production site there were 5 coresponding rows in tr_hist.&lt;/P&gt;&lt;P&gt;So I will write the query in SQl as following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select l.ld_det_name, l.ld_det_spare, l.ld_det_date, elapsed_time(l.ld_date) from ld_det l&amp;nbsp; inner join &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;tr_hist t on l.ld_date = t.tr_date where elapsed_time(l.ld_date) &amp;lt;&amp;gt; 0&lt;BR /&gt;&amp;nbsp; where elapsed_time can be a subroutine/function/procedure&lt;BR /&gt;which will calculate based on following logic&lt;P&gt;&lt;/P&gt;&lt;P&gt;x number;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for eacr row in ld_det &lt;/P&gt;&lt;P&gt;x = ld_tranc&lt;/P&gt;&lt;P&gt;for each row in tr_hist where tr_part = ld_part and tr_date = ld_date&lt;/P&gt;&lt;P&gt;if x &amp;gt; 0 &lt;BR /&gt;x = x - tr_tran &lt;/P&gt;&lt;P&gt;if x &amp;lt; 0 the &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return tr_time&lt;/P&gt;&lt;P&gt;exit&lt;/P&gt;&lt;P&gt;else&lt;BR /&gt;next row of tr_hist&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end if&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end loop1&lt;BR /&gt;end loop2&lt;/P&gt;&lt;P&gt;return 0&lt;BR /&gt;end fucntion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest regarding the issue ASAP &lt;/P&gt;&lt;P&gt;thanks in advance!!!!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 11:30:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-compare-data-between-certain-tables/m-p/302147#M711942</guid>
      <dc:creator />
      <dc:date>2011-06-20T11:30:42Z</dc:date>
    </item>
  </channel>
</rss>

