<?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: Joining Tables with flawed multiple IDs/key values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096278#M935437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Oleg,&lt;/P&gt;&lt;P&gt;Thanks for your answer. They represent keys to the same datapoint, but some of them have not been updated or kept clean. I somehow got it to work using two mapping tables with 1 ID each, left joining the crosstab with both and the concatenated them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Feb 2016 08:34:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-02-24T08:34:57Z</dc:date>
    <item>
      <title>Joining Tables with flawed multiple IDs/key values</title>
      <link>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096276#M935435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 3 tables that I want to left join where one is a table that has the IDs of all the rows that I want in the output and the other two are crosstables with data. The problem is that I have multiple ID fields some of which don't match for some reason.&lt;/P&gt;&lt;P&gt;A small excerpt would be:&lt;/P&gt;&lt;P&gt;mapping:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;ID2&lt;/TD&gt;&lt;TD&gt;ID3&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;xzz&lt;/TD&gt;&lt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TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I know I could just correct the mapping source, but to be honest the source files are a mess and I am not supposed to mess with them. Now what I have so far is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mapping:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ID,&lt;/P&gt;&lt;P&gt;[ID2],&lt;/P&gt;&lt;P&gt;[ID3],&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FROM ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;temp:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;[ID2],&lt;/P&gt;&lt;P&gt;[ID3],&lt;/P&gt;&lt;P&gt;DATA1,&lt;/P&gt;&lt;P&gt;DATA2,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FROM datatable1_source...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE(temp)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;[ID2],&lt;/P&gt;&lt;P&gt;[ID3],&lt;/P&gt;&lt;P&gt;DATA1,&lt;/P&gt;&lt;P&gt;DATA2,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FROM datatable2_source...&lt;/P&gt;&lt;P&gt;WHERE NOT EXISTS([ID2])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;crosstab:&lt;/P&gt;&lt;P&gt;CrossTable(A, Data, 2)&lt;/P&gt;&lt;P&gt;LOAD * Resident temp;&lt;BR /&gt;Drop Table temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEFT JOIN(mapping)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;[ID2],&lt;/P&gt;&lt;P&gt;[ID3],&lt;/P&gt;&lt;P&gt;Data&lt;/P&gt;&lt;P&gt;Resident crosstab;&lt;/P&gt;&lt;P&gt;drop table crosstab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this seems to work for all the fields that don't have a missing or wrong id in mapping. What I would want is something like&lt;/P&gt;&lt;P&gt;If ID2 doesn't have matches, look for ID3 and overwrite ID2. Or maybe only declare one ID at a time in mapping for a single key value and join them afterwards? Can't think of an easier way right now, help would be appreciated. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 15:49:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096276#M935435</guid>
      <dc:creator />
      <dc:date>2016-02-23T15:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Tables with flawed multiple IDs/key values</title>
      <link>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096277#M935436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the key question here is what are the logical relationships between these IDs? Do they represent different keys to the same data entity - for example, Member ID vs. SSN#, both leading to the same person? Or, do they represent different data entities, such as Student ID and Class ID, for example?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can lay out the logical rules of how to look up and substitute missing keys, then you could use mapping to cleans your data in QlikView, before joining the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this approach helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;Upgrade your Qlik skills at the &lt;A href="http://masterssummit.com/"&gt;Masters Summit for Qlik&lt;/A&gt; - coming soon to Milan, Italy and Austin, TX!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 18:28:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096277#M935436</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2016-02-23T18:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Tables with flawed multiple IDs/key values</title>
      <link>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096278#M935437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Oleg,&lt;/P&gt;&lt;P&gt;Thanks for your answer. They represent keys to the same datapoint, but some of them have not been updated or kept clean. I somehow got it to work using two mapping tables with 1 ID each, left joining the crosstab with both and the concatenated them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2016 08:34:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Joining-Tables-with-flawed-multiple-IDs-key-values/m-p/1096278#M935437</guid>
      <dc:creator />
      <dc:date>2016-02-24T08:34:57Z</dc:date>
    </item>
  </channel>
</rss>

