<?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 Data modeling in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759258#M719754</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have been confused with the below data model request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date model request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract &lt;STRONG&gt;MBEW&lt;/STRONG&gt; sheet&lt;/LI&gt;&lt;LI&gt;Extract the History data (Historic Valuation Data with suffix H, i.e. &lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), include only last Reporting Month &lt;STRONG&gt;and left join with MBEW&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Create new table&amp;nbsp; from previous table and&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If the Material Plant Combo has an entry in the History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), then use fields from History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;)&amp;nbsp; else use fields from Actual Table(&lt;STRONG&gt;MBEW&lt;/STRONG&gt;)&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Attached is the sample data.&lt;/P&gt;&lt;P&gt;Please provide any ideas and suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 23:40:23 GMT</pubDate>
    <dc:creator>krish2459</dc:creator>
    <dc:date>2024-11-15T23:40:23Z</dc:date>
    <item>
      <title>Data modeling</title>
      <link>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759258#M719754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have been confused with the below data model request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date model request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract &lt;STRONG&gt;MBEW&lt;/STRONG&gt; sheet&lt;/LI&gt;&lt;LI&gt;Extract the History data (Historic Valuation Data with suffix H, i.e. &lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), include only last Reporting Month &lt;STRONG&gt;and left join with MBEW&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Create new table&amp;nbsp; from previous table and&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If the Material Plant Combo has an entry in the History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), then use fields from History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;)&amp;nbsp; else use fields from Actual Table(&lt;STRONG&gt;MBEW&lt;/STRONG&gt;)&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Attached is the sample data.&lt;/P&gt;&lt;P&gt;Please provide any ideas and suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:40:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759258#M719754</guid>
      <dc:creator>krish2459</dc:creator>
      <dc:date>2024-11-15T23:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Data modeling</title>
      <link>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759306#M719755</link>
      <description>&lt;P&gt;In both tables the period is used in a different meaning, in MBEWH it's a "valid to" period and in MBEW it's a "valid from" period&lt;/P&gt;&lt;P&gt;You need to convert both tables in 3 steps:&lt;BR /&gt;1. Concatenate both tables&lt;BR /&gt;2. Handle the different meaning of period by creating new fields ValidFrom and ValidTo&lt;BR /&gt;3. Make an interval match to get a period for each data set&lt;/P&gt;&lt;P&gt;Here is a sample script how do you can do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let vActPeriod=Floor(MonthStart(today()));
let vMinDate=num(MakeDate(Year(Today())-2,1,1)); // Load only the last three years in datamodel
let vMaxDate=Floor(MonthStart(Today()));

// Step 1 Concatenate both tables
t:
LOAD * FROM [.\MBEWH.qvd] (qvd);

Concatenate(t)
LOAD
*,
1 as Source
FROM [.\MBEW.qvd] (qvd);

// Step 2 Handle the different meaning of period
tt:
LOAD
Hash128(MATNR,BWKEY,BWTAR) as %MBEW,
*,
if(Source=1,num(MakeDate(LFGJA,LFMON,1))) as ValidFromTmp,
if(Source=1,$(vActPeriod),num(MakeDate(LFGJA,LFMON,1))) as ValidTo
Resident t;

DROP Table t;

MBEW:
LOAD
*
Where ValidTo&amp;gt;=$(vMinDate);
LOAD
*,
if(IsNull(ValidFromTmp),if(Previous(%MBEW)=%MBEW,AddMonths(Previous(ValidTo),1),ValidTo),ValidFromTmp) as ValidFrom
Resident tt
Order by %MBEW, ValidTo;

DROP Fields Source,ValidFromTmp;
DROP Table tt;

// Step 3 Interval match
t:
LOAD Distinct
ValidFrom,
ValidTo
Resident MBEW;

PERIODS:
LOAD
PERIOD
Where Day(PERIOD)=1;
LOAD
RecNo()+$(vMinDate)-1 as PERIOD
AutoGenerate $(vMaxDate)-$(vMinDate)+1;

tt:
IntervalMatch(PERIOD)
LOAD
ValidFrom,
ValidTo
Resident t;

DROP Tables t,PERIODS;

Inner Join (MBEW)
LOAD Distinct * Resident tt;

DROP Fields ValidFrom,ValidTo;
DROP Table tt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 12:43:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759306#M719755</guid>
      <dc:creator>cwolf</dc:creator>
      <dc:date>2020-11-06T12:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Data modeling</title>
      <link>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759886#M719756</link>
      <description>&lt;P&gt;Hi cwolf ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please expain the logic what you have post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like suggention going on other direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hers is the requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Extract&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;MBEW&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sheet&lt;/LI&gt;&lt;LI&gt;Extract the History data (Historic Valuation Data with suffix H, i.e.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), include only Reporting Month year (Year&amp;amp;Month)&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;and left join with MBEW&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Create new table&amp;nbsp; from previous table and&lt;OL&gt;&lt;LI&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If the Material Plant Combo has an entry in the History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;), then use fields from History Table(&lt;STRONG&gt;MBEWH&lt;/STRONG&gt;)&amp;nbsp; else use fields from Actual Table(&lt;STRONG&gt;MBEW&lt;/STRONG&gt;).&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks..&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 14:39:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-modeling/m-p/1759886#M719756</guid>
      <dc:creator>krish2459</dc:creator>
      <dc:date>2020-11-09T14:39:42Z</dc:date>
    </item>
  </channel>
</rss>

