<?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 Costs/sales in different fact tables - Calculate a margin? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Costs-sales-in-different-fact-tables-Calculate-a-margin/m-p/1544940#M39271</link>
    <description>&lt;P&gt;Hi community!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Background:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have two fact tables. In the first fact table, I have &lt;STRONG&gt;costs&lt;/STRONG&gt; (the data field), as well as keys to dimension of what &lt;STRONG&gt;cost-type&lt;/STRONG&gt;, what &lt;STRONG&gt;item-type&lt;/STRONG&gt;, and what &lt;STRONG&gt;time&lt;/STRONG&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In the second fact table, I have the &lt;STRONG&gt;sales&lt;/STRONG&gt; (the data field). Again, I have keys to dimensions of what &lt;STRONG&gt;item-type&lt;/STRONG&gt; and at what &lt;STRONG&gt;time&lt;/STRONG&gt;. I also have a &lt;STRONG&gt;customer-key&lt;/STRONG&gt;. However, I&lt;EM&gt; do not have a cost key,&lt;/EM&gt; since it is the table of sales.&lt;BR /&gt;&lt;BR /&gt;My problem is that I would like to be able to calculate a &lt;U&gt;margin per customer-type&lt;/U&gt;.&lt;BR /&gt;This means, that I would like to sum&amp;nbsp;sales&amp;nbsp;that have occured for a&amp;nbsp;customer&lt;STRONG&gt;,&amp;nbsp;&lt;/STRONG&gt;with help of the fact that they have the&amp;nbsp;item in common&lt;STRONG&gt;.&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Getting the margin per item is easy, but as soon as I filter for a customer dimension, the costs and the margin turns to 0 - since the customers have no costs recorded on them. But if I select an item type, I see both sales and costs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I feel like there should be a way to filter out customer as well to get the sales and costs for a specific month, but perhaps I need to re-think my data model and add something else, like quantity, in order to perform a calculation that will work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached a picture of my data set (which with current set-up creates synthetic tables).&lt;BR /&gt;I would like to hear your advice on:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Is this even possible to accomplish what I am looking for?&lt;/P&gt;&lt;P&gt;2) If possible, what would the smartest way forward be? (LinkTable or concatenate?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very thankful for your support or thoughts, friends!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 06:34:44 GMT</pubDate>
    <dc:creator>rasmusilestedt</dc:creator>
    <dc:date>2024-11-16T06:34:44Z</dc:date>
    <item>
      <title>Costs/sales in different fact tables - Calculate a margin?</title>
      <link>https://community.qlik.com/t5/App-Development/Costs-sales-in-different-fact-tables-Calculate-a-margin/m-p/1544940#M39271</link>
      <description>&lt;P&gt;Hi community!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Background:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have two fact tables. In the first fact table, I have &lt;STRONG&gt;costs&lt;/STRONG&gt; (the data field), as well as keys to dimension of what &lt;STRONG&gt;cost-type&lt;/STRONG&gt;, what &lt;STRONG&gt;item-type&lt;/STRONG&gt;, and what &lt;STRONG&gt;time&lt;/STRONG&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In the second fact table, I have the &lt;STRONG&gt;sales&lt;/STRONG&gt; (the data field). Again, I have keys to dimensions of what &lt;STRONG&gt;item-type&lt;/STRONG&gt; and at what &lt;STRONG&gt;time&lt;/STRONG&gt;. I also have a &lt;STRONG&gt;customer-key&lt;/STRONG&gt;. However, I&lt;EM&gt; do not have a cost key,&lt;/EM&gt; since it is the table of sales.&lt;BR /&gt;&lt;BR /&gt;My problem is that I would like to be able to calculate a &lt;U&gt;margin per customer-type&lt;/U&gt;.&lt;BR /&gt;This means, that I would like to sum&amp;nbsp;sales&amp;nbsp;that have occured for a&amp;nbsp;customer&lt;STRONG&gt;,&amp;nbsp;&lt;/STRONG&gt;with help of the fact that they have the&amp;nbsp;item in common&lt;STRONG&gt;.&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Getting the margin per item is easy, but as soon as I filter for a customer dimension, the costs and the margin turns to 0 - since the customers have no costs recorded on them. But if I select an item type, I see both sales and costs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I feel like there should be a way to filter out customer as well to get the sales and costs for a specific month, but perhaps I need to re-think my data model and add something else, like quantity, in order to perform a calculation that will work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached a picture of my data set (which with current set-up creates synthetic tables).&lt;BR /&gt;I would like to hear your advice on:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Is this even possible to accomplish what I am looking for?&lt;/P&gt;&lt;P&gt;2) If possible, what would the smartest way forward be? (LinkTable or concatenate?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very thankful for your support or thoughts, friends!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:34:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Costs-sales-in-different-fact-tables-Calculate-a-margin/m-p/1544940#M39271</guid>
      <dc:creator>rasmusilestedt</dc:creator>
      <dc:date>2024-11-16T06:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Costs/sales in different fact tables - Calculate a margin?</title>
      <link>https://community.qlik.com/t5/App-Development/Costs-sales-in-different-fact-tables-Calculate-a-margin/m-p/1544961#M39274</link>
      <description>&lt;P&gt;Could a solution be to add two more fields in each fact table regarding quantity? In this way, I can get the cost per item produced as well as price paid for each customer/item transaction.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But in the next step, I do not know if it would be possible to do a set analysis and subtract price paid (item/customer) minus cost of producing (item).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 12:50:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Costs-sales-in-different-fact-tables-Calculate-a-margin/m-p/1544961#M39274</guid>
      <dc:creator>rasmusilestedt</dc:creator>
      <dc:date>2019-02-15T12:50:39Z</dc:date>
    </item>
  </channel>
</rss>

