<?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: Problem in building single Key from multiple QVDs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657462#M1083411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure I fully follow what the problem is here, but if I have understood correctly, you can build a composite key on both the Shipping Dim and Order Data tables.&amp;nbsp; Simply do string concatenations, eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;product_id &amp;amp; ':' &amp;amp; export_country &amp;amp; ':' &amp;amp; country as ProductCountryKey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally do this as you create QVD's, rather than when loading from them so that optimised loads from QVD can be performed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general it is best not to use the JOIN statement in your QlikView load, unless you have a good reason and you have a clear understanding of the consequences.&amp;nbsp; Build keys and then remove fields that are no longer needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the Shipping table has all possible ProductCountryKey variations this is quite straight forward, have the key and all three fields in the shipping table in your end model and just the ProductCountryKey in the Order Data table.&amp;nbsp; If it is possible that there are keys in the Order that don't exist in the Shipping table you will need to create a Link Table.&amp;nbsp; This needs to be created with the fields ProductCountryKey, product_id, export_country and country, and needs to be created from a RESIDENT load from both tables.&amp;nbsp; You then need to explicitly DROP FIELD all of the non key fields from both tables (as they will be found in the Link Table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your expression will then be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(sum(orders) = 0, 'No Orders', sum(orders))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that all makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jun 2014 11:54:24 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2014-06-27T11:54:24Z</dc:date>
    <item>
      <title>Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657459#M1083408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have&lt;/P&gt;&lt;P&gt;product data - QVD, &lt;/P&gt;&lt;P&gt;shipping table (all ONLY ACTIVE products offers millions of records) - QVD, &lt;/P&gt;&lt;P&gt;merchant table - QVD&lt;/P&gt;&lt;P&gt;Order Data (All ACTIVE and DEACTIVATED products orders) - &lt;STRONG&gt;&lt;EM&gt;New information to add.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(please refer to diagram attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want output in such a manner that if any order for that product (exporting and importing country wise) is placed, then it should populate orders against it. OR prompt (NO Orders)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly is a product is de-activated and there were orders, table should have that product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was looking to built a key product_id &amp;amp; export_country &amp;amp; country to match (outer join) but due to multiple QVDs I am not sure how to proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired Result:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="desired Result.png" class="jive-image" src="/legacyfs/online/61219_desired Result.png" style="width: 620px; height: 444px;" /&gt;&lt;/P&gt;&lt;P&gt;Present Data model:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="present datamodel without order_data.png" class="jive-image" src="/legacyfs/online/61238_present datamodel without order_data.png" style="width: 620px; height: 434px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Present Detailed Load Script:&lt;/P&gt;&lt;P&gt;shipping_dim:&lt;/P&gt;&lt;P&gt;LOAD schema_type, shipping_costs_sk, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_sk as shp_product_sk, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product_id,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currency as cur_currency, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; country as las_country, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; region, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; net_retail_price, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shipping_cost, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other_cost, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vat_cost, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; customer_cost&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;E:\QVDs\QVDs\shipping_dim.qvd&lt;/P&gt;&lt;P&gt;(qvd)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;product_dim:&lt;/P&gt;&lt;P&gt;LOAD `product_sk`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `merchant_sk`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `brand_name`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `product_id`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `product_name`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `redemption_type`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `product_type`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `is_active`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `category_name`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; discount,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; release_date;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM `ll_etl`.`vdc_ll_product_dim`;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;join (product_dim)&lt;/P&gt;&lt;P&gt;LOAD merchant_sk, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merchant_id, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merchant_name, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merchant_type, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merchant_currency, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; team, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exporting_country, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; region as mer_region, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; network_id, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; network_name, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merchant_status&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;E:\QVDs\QVDs\merchant_dim.qvd&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New Table to add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;odr_data:&lt;/P&gt;&lt;P&gt;LOAD `program_code`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `product_id` ,&lt;/P&gt;&lt;P&gt;&amp;nbsp; country ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `exporting_country` ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `year_no`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `month_display`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `month_no`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `redemption_type`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `promo_order_flag`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; orders,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `turnover_eur`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `turnover_usd`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `ordered_products`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `ll_profit`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `ll_profit_usd`,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; `cc_fees`;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM `ll_etl`.`vdc_ll_last_2_yrs`;&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;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in Advance for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks and Regards&lt;/P&gt;&lt;P&gt;- Deep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 07:47:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657459#M1083408</guid>
      <dc:creator />
      <dc:date>2014-06-26T07:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657460#M1083409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;Do a Left join between&lt;/P&gt;&lt;P&gt;Shipping and Orders&lt;/P&gt;&lt;P&gt;then try to map with the product_dim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 08:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657460#M1083409</guid>
      <dc:creator>sasikanth</dc:creator>
      <dc:date>2014-06-26T08:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657461#M1083410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Sasikanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help but I am looking for a combination of product id + export country + country. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I join shipping and Orders I will have to join on product id + country (export country will be missing)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards&lt;/P&gt;&lt;P&gt;- Deep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 04:39:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657461#M1083410</guid>
      <dc:creator />
      <dc:date>2014-06-27T04:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657462#M1083411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure I fully follow what the problem is here, but if I have understood correctly, you can build a composite key on both the Shipping Dim and Order Data tables.&amp;nbsp; Simply do string concatenations, eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;product_id &amp;amp; ':' &amp;amp; export_country &amp;amp; ':' &amp;amp; country as ProductCountryKey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally do this as you create QVD's, rather than when loading from them so that optimised loads from QVD can be performed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general it is best not to use the JOIN statement in your QlikView load, unless you have a good reason and you have a clear understanding of the consequences.&amp;nbsp; Build keys and then remove fields that are no longer needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the Shipping table has all possible ProductCountryKey variations this is quite straight forward, have the key and all three fields in the shipping table in your end model and just the ProductCountryKey in the Order Data table.&amp;nbsp; If it is possible that there are keys in the Order that don't exist in the Shipping table you will need to create a Link Table.&amp;nbsp; This needs to be created with the fields ProductCountryKey, product_id, export_country and country, and needs to be created from a RESIDENT load from both tables.&amp;nbsp; You then need to explicitly DROP FIELD all of the non key fields from both tables (as they will be found in the Link Table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your expression will then be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(sum(orders) = 0, 'No Orders', sum(orders))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that all makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 11:54:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657462#M1083411</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-06-27T11:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657463#M1083412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You for your comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trouble here is:&lt;/P&gt;&lt;P&gt;1. Making a Key from multiple fields loaded from more than 1 QVDs&lt;/P&gt;&lt;P&gt;(shipping dim have partially &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ProductCountryKey (export country is missing which get load from another QVD i.e. merchant_dim))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Composite key I am looking to make is &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;product_id, export_country and country (which is present in Order Table)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest to encounter this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;- Deep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 11:05:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657463#M1083412</guid>
      <dc:creator />
      <dc:date>2014-06-30T11:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in building single Key from multiple QVDs</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657464#M1083413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps you could map in the extra key using an ApplyMap?&amp;nbsp; Or, as the underlying data store is a RDBMS you could bring the data across in a JOIN.&amp;nbsp; Try to avoid duplicating large string values by using SQL Joins (this is why ApplyMap is generally preferable).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 18:55:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-building-single-Key-from-multiple-QVDs/m-p/657464#M1083413</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-06-30T18:55:33Z</dc:date>
    </item>
  </channel>
</rss>

