<?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 Two fact table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Two-fact-table/m-p/104010#M755674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All, I am stuck with a complex problem. Do any of you know how I can work my way around it?&lt;/P&gt;&lt;P&gt; I have SHIPDATE and RETDATE in two fact tables. I should create two different tables &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st table&lt;/STRONG&gt; : eg: If panel SHIPDATE(Shipped) on 01-01-2017 and was RETDATE (returned) on 01-02-2017 count as 1 for the month of&amp;nbsp; return. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd table&lt;/STRONG&gt; : eg: If a panel SHIPDATE(Shipped) on 01-01-2017 and was RETDATE(returned) on 01-02-2017 count 1 for the month of Shipment. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This needs to be done with the total of shipment and return remaining the same but bucketed differently in each table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of what I have : &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>krithikarees</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Two fact table</title>
      <link>https://community.qlik.com/t5/QlikView/Two-fact-table/m-p/104010#M755674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All, I am stuck with a complex problem. Do any of you know how I can work my way around it?&lt;/P&gt;&lt;P&gt; I have SHIPDATE and RETDATE in two fact tables. I should create two different tables &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st table&lt;/STRONG&gt; : eg: If panel SHIPDATE(Shipped) on 01-01-2017 and was RETDATE (returned) on 01-02-2017 count as 1 for the month of&amp;nbsp; return. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2nd table&lt;/STRONG&gt; : eg: If a panel SHIPDATE(Shipped) on 01-01-2017 and was RETDATE(returned) on 01-02-2017 count 1 for the month of Shipment. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This needs to be done with the total of shipment and return remaining the same but bucketed differently in each table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example of what I have : &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Two-fact-table/m-p/104010#M755674</guid>
      <dc:creator>krithikarees</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Two fact table</title>
      <link>https://community.qlik.com/t5/QlikView/Two-fact-table/m-p/104011#M755675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dont quite understand your requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have sales data, so you have the shipping and return date on the same data and data table or are they separate?&lt;/P&gt;&lt;P&gt;If you only need to count:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;numbers of shipped orders&lt;/LI&gt;&lt;LI&gt;numbers of returned orders (meaning in this case they've been shipped at a given point)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can simply create some flags with those rules and apply a simple sum on the created field to create your fact tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15378928725437832" jivemacro_uid="_15378928725437832"&gt;
&lt;P&gt;SalesDim:&lt;/P&gt;
&lt;P&gt;Load SaleId,&lt;/P&gt;
&lt;P&gt;Value,&lt;/P&gt;
&lt;P&gt;Date#(CreatedDate,'DD/MM/YYYY') as CreatedDate,&lt;/P&gt;
&lt;P&gt;Date#(ShipDate,'DD/MM/YYYY') as ShipDate,&lt;/P&gt;
&lt;P&gt;Date#(ReturnDate,'DD/MM/YYYY') as ReturnDate,&lt;/P&gt;
&lt;P&gt;DealerId;&lt;/P&gt;
&lt;P&gt;Load * Inline&lt;/P&gt;
&lt;P&gt;[&lt;/P&gt;
&lt;P&gt;SaleId,Value,CreatedDate,ShipDate,ReturnDate,DealerId&lt;/P&gt;
&lt;P&gt;1,10000,01/01/2018,05/01/2018,09/01/2018,A&lt;/P&gt;
&lt;P&gt;2,500,05/01/2018,09/01/2018,,A&lt;/P&gt;
&lt;P&gt;3,9994,08/08/2018,01/09/2018,24/09/2018,B&lt;/P&gt;
&lt;P&gt;4,3555,25/09/2018,,,C&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;SalesFact:&lt;/P&gt;
&lt;P&gt;Load SaleId,&lt;/P&gt;
&lt;P&gt;if(len(ShipDate)&amp;gt;0,1,0) as [Order shipped flag],&lt;/P&gt;
&lt;P&gt;if(len(ShipDate)&amp;gt;0 and len(ReturnDate)&amp;gt;0,1,0) as [Order Returned flag]&lt;/P&gt;
&lt;P&gt;Resident SalesDim;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With that, you can check in a simple graph the sum of each flag to check your metric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the attached QVW for a simple solution with some dummy data.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sample.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/214433_sample.png" style="height: 496px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example, I have 4 orders, 3 of which have been shipped and only 2 of those where returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2018 16:16:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Two-fact-table/m-p/104011#M755675</guid>
      <dc:creator>felipedl</dc:creator>
      <dc:date>2018-09-25T16:16:35Z</dc:date>
    </item>
  </channel>
</rss>

