<?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 do I calculate Age in the load using data from two tables? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257174#M97214</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess the common field in both tables will be the name of the patient, thus tables would be linked like&lt;/P&gt;&lt;P&gt;Demographic: LOAD Name, Birthday .... FROM .....;&lt;/P&gt;&lt;P&gt;Encounter: LOAD Name, EncounterDate, .... FROM ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus as expression in your tables etc you may use EncounterDate - Birthday in order to calculate the birth.&lt;/P&gt;&lt;P&gt;If you need to calculate this in your script, you need to JOIN the tables first and then add as new field something like&lt;/P&gt;&lt;P&gt;EncounterDate - Birthday AS Age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;BR /&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jun 2011 13:08:14 GMT</pubDate>
    <dc:creator>prieper</dc:creator>
    <dc:date>2011-06-01T13:08:14Z</dc:date>
    <item>
      <title>How do I calculate Age in the load using data from two tables?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257172#M97212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate the age using BIRTH_DATE from the Demographics table I'm loading and then use ENCOUNTER_DATE from the Procedures table. How do I&amp;nbsp; do this in the Load Script? I would like to know how old the patient is at the time of each procedure is done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Karen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 12:51:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257172#M97212</guid>
      <dc:creator />
      <dc:date>2011-06-01T12:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate Age in the load using data from two tables?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257173#M97213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Karen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With no better knowledge of your data model I'll assume you have a Patient_ID in both Demographics and Procedures table. If this is the case, I'd use a Mapping table based on Demographics and applied to the Procedures table, using Patient_ID as main parameter. Basically, it will look like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Demographics:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;FROM Demographics.Source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PatientBirthdateMap:&lt;/P&gt;&lt;P&gt;MAPPING LOAD Patient_ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Birth_Date&lt;/P&gt;&lt;P&gt;FROM Demographics.Source;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Procedures:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age(Encounter_Date, ApplyMap('PatientBirthdateMap', Patient_ID)) AS Patient_Age&lt;/P&gt;&lt;P&gt;FROM Procedures.Source;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take special care on the dates formats, the more similar they are the lesser problems you will encounter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 13:06:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257173#M97213</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-06-01T13:06:46Z</dc:date>
    </item>
    <item>
      <title>How do I calculate Age in the load using data from two tables?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257174#M97214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess the common field in both tables will be the name of the patient, thus tables would be linked like&lt;/P&gt;&lt;P&gt;Demographic: LOAD Name, Birthday .... FROM .....;&lt;/P&gt;&lt;P&gt;Encounter: LOAD Name, EncounterDate, .... FROM ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus as expression in your tables etc you may use EncounterDate - Birthday in order to calculate the birth.&lt;/P&gt;&lt;P&gt;If you need to calculate this in your script, you need to JOIN the tables first and then add as new field something like&lt;/P&gt;&lt;P&gt;EncounterDate - Birthday AS Age.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;BR /&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 13:08:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257174#M97214</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2011-06-01T13:08:14Z</dc:date>
    </item>
    <item>
      <title>How do I calculate Age in the load using data from two tables?</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257175#M97215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank you both.&amp;nbsp; Your suggestions and example we great and really helped.&amp;nbsp; I was able to get it figured out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Karen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2011 14:07:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-I-calculate-Age-in-the-load-using-data-from-two-tables/m-p/257175#M97215</guid>
      <dc:creator />
      <dc:date>2011-06-01T14:07:41Z</dc:date>
    </item>
  </channel>
</rss>

