<?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 Build data model containing Bill of Material (BOM) - link table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Build-data-model-containing-Bill-of-Material-BOM-link-table/m-p/1858815#M70896</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have been breaking my head over this for a while now.&lt;/P&gt;
&lt;P&gt;I have a data model that is, for the sake of simplicity, based on two separate dimensions:&lt;/P&gt;
&lt;P&gt;product_id and rawmaterial_product_id.&lt;/P&gt;
&lt;P&gt;I have three fact tables,&lt;/P&gt;
&lt;P&gt;1) forecast for the product_id&lt;/P&gt;
&lt;P&gt;2) stock levels for the rawmaterial_product_id&lt;/P&gt;
&lt;P&gt;3) stock purchases for the rawmaterial_product_id&lt;/P&gt;
&lt;P&gt;And two dimension tables, one for product_id details and one for rawmaterial_product_id details.&lt;/P&gt;
&lt;P&gt;And one BOM table, containing relationship between product_id and rawmaterial_product_id and ratio need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have managed building a link table which accurately reflects the data in the model, but I am stuck in developing this in the front-end. The expected front-end result will be that the resulting table is something like below:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;product_id&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product_id&lt;/TD&gt;
&lt;TD width="10%"&gt;ratio&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;product_forecast&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product.stock&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product.purchases&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;A&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;aa&lt;/TD&gt;
&lt;TD width="10%"&gt;100%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;5&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;A&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;bb&lt;/TD&gt;
&lt;TD width="10%"&gt;50%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;5&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;aa&lt;/TD&gt;
&lt;TD width="10%"&gt;200%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;cc&lt;/TD&gt;
&lt;TD width="10%"&gt;0%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;dd&lt;/TD&gt;
&lt;TD width="10%"&gt;1200%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;50&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my existing app I can achieve this using Aggr function, but to make it more user friendly we want to implement it in the data model instead.&lt;/P&gt;
&lt;P&gt;The problem I run into is that whenever the user selects product A or B for example, the stock levels will show 0 because the rawmaterial_product tables don't contain a reference to the product_id. Same goes for selection the raw material which makes the FC level go to 0.&lt;/P&gt;
&lt;P&gt;Working with applymap() is not an option due to the many to many relationship. I'm thinking instead I should either join it to my dimension table or create an additional dimension table. Not even sure if I should call the BOM table a dimension table in this case.&lt;/P&gt;
&lt;P&gt;I've read this (&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Bill-of-Materials/ba-p/1462792" target="_self"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Bill-of-Materials/ba-p/1462792&lt;/A&gt;&amp;nbsp;) article and few others on the topic but do not see directly how they can help me.&lt;/P&gt;
&lt;P&gt;If anyone could be of help here I would be eternally grateful :).&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;PS I have attached some sample data. I am not used to explaining these question in writing so hope my case is clear.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 15:58:30 GMT</pubDate>
    <dc:creator>HarryLouis</dc:creator>
    <dc:date>2021-11-12T15:58:30Z</dc:date>
    <item>
      <title>Build data model containing Bill of Material (BOM) - link table</title>
      <link>https://community.qlik.com/t5/App-Development/Build-data-model-containing-Bill-of-Material-BOM-link-table/m-p/1858815#M70896</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have been breaking my head over this for a while now.&lt;/P&gt;
&lt;P&gt;I have a data model that is, for the sake of simplicity, based on two separate dimensions:&lt;/P&gt;
&lt;P&gt;product_id and rawmaterial_product_id.&lt;/P&gt;
&lt;P&gt;I have three fact tables,&lt;/P&gt;
&lt;P&gt;1) forecast for the product_id&lt;/P&gt;
&lt;P&gt;2) stock levels for the rawmaterial_product_id&lt;/P&gt;
&lt;P&gt;3) stock purchases for the rawmaterial_product_id&lt;/P&gt;
&lt;P&gt;And two dimension tables, one for product_id details and one for rawmaterial_product_id details.&lt;/P&gt;
&lt;P&gt;And one BOM table, containing relationship between product_id and rawmaterial_product_id and ratio need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have managed building a link table which accurately reflects the data in the model, but I am stuck in developing this in the front-end. The expected front-end result will be that the resulting table is something like below:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;product_id&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product_id&lt;/TD&gt;
&lt;TD width="10%"&gt;ratio&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;product_forecast&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product.stock&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;rm_product.purchases&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;A&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;aa&lt;/TD&gt;
&lt;TD width="10%"&gt;100%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;5&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;A&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;bb&lt;/TD&gt;
&lt;TD width="10%"&gt;50%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;5&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;aa&lt;/TD&gt;
&lt;TD width="10%"&gt;200%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;1&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;cc&lt;/TD&gt;
&lt;TD width="10%"&gt;0%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="24px"&gt;B&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;dd&lt;/TD&gt;
&lt;TD width="10%"&gt;1200%&lt;/TD&gt;
&lt;TD width="10%" height="24px"&gt;10&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;0&lt;/TD&gt;
&lt;TD width="20%" height="24px"&gt;50&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my existing app I can achieve this using Aggr function, but to make it more user friendly we want to implement it in the data model instead.&lt;/P&gt;
&lt;P&gt;The problem I run into is that whenever the user selects product A or B for example, the stock levels will show 0 because the rawmaterial_product tables don't contain a reference to the product_id. Same goes for selection the raw material which makes the FC level go to 0.&lt;/P&gt;
&lt;P&gt;Working with applymap() is not an option due to the many to many relationship. I'm thinking instead I should either join it to my dimension table or create an additional dimension table. Not even sure if I should call the BOM table a dimension table in this case.&lt;/P&gt;
&lt;P&gt;I've read this (&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Bill-of-Materials/ba-p/1462792" target="_self"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Bill-of-Materials/ba-p/1462792&lt;/A&gt;&amp;nbsp;) article and few others on the topic but do not see directly how they can help me.&lt;/P&gt;
&lt;P&gt;If anyone could be of help here I would be eternally grateful :).&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;PS I have attached some sample data. I am not used to explaining these question in writing so hope my case is clear.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 15:58:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Build-data-model-containing-Bill-of-Material-BOM-link-table/m-p/1858815#M70896</guid>
      <dc:creator>HarryLouis</dc:creator>
      <dc:date>2021-11-12T15:58:30Z</dc:date>
    </item>
  </channel>
</rss>

