<?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: How to join multiple tables to avoid circular joins in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484996#M101213</link>
    <description>&lt;P&gt;Hi KJM,&lt;/P&gt;
&lt;P&gt;Thank you so much for quick reply and possible solution. Unfortunately I can't join revenue and customer tables. This is an existing app and those two tables are associated using Keep. But I think I could follow your solution. I guess I need to create another table and pull tkt_nbr and cust_id fields into it and create a link key. And then create the same key and import only the other fields from cust_privilege table. I am not sure if I will be able to do that. If you think it won't work please let me know. Thank you again for your help.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2024 23:53:16 GMT</pubDate>
    <dc:creator>Qlik_Learner11</dc:creator>
    <dc:date>2024-10-02T23:53:16Z</dc:date>
    <item>
      <title>How to join multiple tables to avoid circular joins</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484776#M101171</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I have benefited from you multiple times in the past. I request you to please help me this time too.&lt;/P&gt;
&lt;P&gt;There are 3 tables revenue, customer and cust_privilege. you can see the fields in each of the tables below. There are more fields in the actual tables but I am skipping them for the context.&lt;/P&gt;
&lt;TABLE width="79"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="79"&gt;revenue&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tkt_key&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tkt_nbr&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tkt_iss_date&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tkt_price&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_key&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="74"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="74"&gt;customer&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_key&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_name&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_id&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE width="96"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="96"&gt;cust_privilege&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tkt_nbr&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_id&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;cust_status&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;revenue and customer tables are already being loaded in the script. Now I need to add cust_privilege table to the script. revenue table is associated with customer table on cust_key field. So, if I select tkt_nbr, all the associated customer names will be filtered in the list box.&lt;/P&gt;
&lt;P&gt;My requirement is when I click a customer name in the list box, it's associated cust_status from cust_privilege table should be filtered. To achieve this I am not sure how to join the cust_privilege table with already existing revenue and customer tables. If I join the cust_privilege table with revenue table on tkt_nbr, selecting the customer name would filter all the cust_ids associated with the tkt_nbr. And If I join the cust_privilege table with customer table on cust_id, then selecting customer name would filter the cust_id and cust_status but for all tkt_nbrs. Please note cust_status value is different for each tkt_nbr and cust_id combination. To get the cust_status for a customer, we need both tkt_nbr and cust_id combination.&lt;/P&gt;
&lt;P&gt;Joining cust_privilege table to revenue table on tkt_nbr and joining cust_privilege table to customer table on cust_id will create circular join which is not recommended. &lt;BR /&gt;I am not sure how to join all these tables so that when I select a customer name, it should filter all the ticket numbers, and when i select a ticket number, and it should filter the associated cust_id and cust_status. I hope I was able to explain the problem in detail.&lt;/P&gt;
&lt;P&gt;Please someone suggest a solution. Thanks so very much in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 00:01:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484776#M101171</guid>
      <dc:creator>Qlik_Learner11</dc:creator>
      <dc:date>2024-10-02T00:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to join multiple tables to avoid circular joins</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484826#M101174</link>
      <description>&lt;P&gt;Hi Qlik Learner!&lt;/P&gt;
&lt;P&gt;Could you use a Join to add cust_name and cust_id to the revenue table based on the cust_key field and then use a link table to avoid synthetic keys on the remaining two tables?&amp;nbsp; There are tutorials on youtube on link tables but I think I'd do something like the following (albeit I would prefer to play about with the app to be sure!)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#left join the customer fields to the revenue and drop customer from the model
Left Join (revenue)
Load * Resident customer;
Drop Table customer;

#create a link key for the link table in each table
revenue_withkey:
Load
    *,
    [tkt_nbr] &amp;amp; [cust_id] as linkKey
Resident revenue;
Drop Table revenue;

cust_privilege_withkey:
Load
    *,
    [tkt_nbr] &amp;amp; [cust_id] as linkKey
Resident cust_privilege;
Drop Table cust_privilege;

#create the link table and drop the fields from the originals
LinkTable:
Load distinct*;
Load
    linkKey,
    [tkt_nbr],
    [cust_id]
Resident revenue_withkey;

Load
    linkKey,
    [tkt_nbr],
    [cust_id]
Resident cust_privilege_withkey;

drop fields [tkt_nbr], [cust_id] from revenue_withkey,cust_privilege_withkey; 
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure that's not perfect.&amp;nbsp; It might need a NoConcatenate somewhere.&amp;nbsp; But I think its nearly there in terms of what you need.&amp;nbsp; If this helps please like and mark as solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;K.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 08:17:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484826#M101174</guid>
      <dc:creator>KJM</dc:creator>
      <dc:date>2024-10-02T08:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to join multiple tables to avoid circular joins</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484996#M101213</link>
      <description>&lt;P&gt;Hi KJM,&lt;/P&gt;
&lt;P&gt;Thank you so much for quick reply and possible solution. Unfortunately I can't join revenue and customer tables. This is an existing app and those two tables are associated using Keep. But I think I could follow your solution. I guess I need to create another table and pull tkt_nbr and cust_id fields into it and create a link key. And then create the same key and import only the other fields from cust_privilege table. I am not sure if I will be able to do that. If you think it won't work please let me know. Thank you again for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2024 23:53:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-join-multiple-tables-to-avoid-circular-joins/m-p/2484996#M101213</guid>
      <dc:creator>Qlik_Learner11</dc:creator>
      <dc:date>2024-10-02T23:53:16Z</dc:date>
    </item>
  </channel>
</rss>

