<?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 Fill missing dates and use old value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731080#M722370</link>
    <description>&lt;P&gt;I have a table as below in the QVW attached.&lt;/P&gt;&lt;P&gt;RAW:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Date,ID,Type,Value&lt;/P&gt;&lt;P&gt;07/23/2020,11,Plates,1000&lt;/P&gt;&lt;P&gt;07/24/2020,11,Plates,1200&lt;/P&gt;&lt;P&gt;7/27/2020,11,Plates,1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;07/23/2020,11,Cups,800&lt;/P&gt;&lt;P&gt;07/24/2020,11,Cups,1200&lt;/P&gt;&lt;P&gt;07/27/2020,11,Cups,500&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;07/23/2020,15,Plates,850&lt;/P&gt;&lt;P&gt;07/24/2020,15,Plates,500,&lt;/P&gt;&lt;P&gt;07/25/2020,15,Plates,700&lt;/P&gt;&lt;P&gt;7/27/2020,15,Plates,1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;07/23/2020,15,Cups,200&lt;/P&gt;&lt;P&gt;07/24/2020,15,Cups,150&lt;/P&gt;&lt;P&gt;07/27/2020,15,Cups,500&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to fill the missing dates and use the same value prior to that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, generate missing dates 7/25, 7/26 and show the previous value from 7/24, which is 1200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my sample QVW, it is failing. Not sure what's wrong here. I also have ID and Type as additional fields and maybe that's breaking your logic.&lt;/P&gt;&lt;P&gt;I may also add more fields in the future, so don't want this logic to break if I add new fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;I had seen you solve something similar in the past. Any help is highly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 00:15:14 GMT</pubDate>
    <dc:creator>qlikwiz123</dc:creator>
    <dc:date>2024-11-16T00:15:14Z</dc:date>
    <item>
      <title>Fill missing dates and use old value</title>
      <link>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731080#M722370</link>
      <description>&lt;P&gt;I have a table as below in the QVW attached.&lt;/P&gt;&lt;P&gt;RAW:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Date,ID,Type,Value&lt;/P&gt;&lt;P&gt;07/23/2020,11,Plates,1000&lt;/P&gt;&lt;P&gt;07/24/2020,11,Plates,1200&lt;/P&gt;&lt;P&gt;7/27/2020,11,Plates,1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;07/23/2020,11,Cups,800&lt;/P&gt;&lt;P&gt;07/24/2020,11,Cups,1200&lt;/P&gt;&lt;P&gt;07/27/2020,11,Cups,500&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;07/23/2020,15,Plates,850&lt;/P&gt;&lt;P&gt;07/24/2020,15,Plates,500,&lt;/P&gt;&lt;P&gt;07/25/2020,15,Plates,700&lt;/P&gt;&lt;P&gt;7/27/2020,15,Plates,1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;07/23/2020,15,Cups,200&lt;/P&gt;&lt;P&gt;07/24/2020,15,Cups,150&lt;/P&gt;&lt;P&gt;07/27/2020,15,Cups,500&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to fill the missing dates and use the same value prior to that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, generate missing dates 7/25, 7/26 and show the previous value from 7/24, which is 1200.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my sample QVW, it is failing. Not sure what's wrong here. I also have ID and Type as additional fields and maybe that's breaking your logic.&lt;/P&gt;&lt;P&gt;I may also add more fields in the future, so don't want this logic to break if I add new fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;I had seen you solve something similar in the past. Any help is highly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:15:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731080#M722370</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2024-11-16T00:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Fill missing dates and use old value</title>
      <link>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731268#M722371</link>
      <description>&lt;P&gt;please do not duplicate the same Ticket.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/New-to-QlikView/Fill-missing-dates-and-use-old-value/m-p/1731078#M391561" target="_blank"&gt;https://community.qlik.com/t5/New-to-QlikView/Fill-missing-dates-and-use-old-value/m-p/1731078#M391561&lt;/A&gt;&lt;/P&gt;&lt;P&gt;here are already information about his problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 08:09:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731268#M722371</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-28T08:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fill missing dates and use old value</title>
      <link>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731771#M722372</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;RAW:
LOAD * INLINE [
    Date, ID, Type, Value
    07/23/2020, 11, Plates, 1000
    07/24/2020, 11, Plates, 1200
    7/27/2020, 11, Plates, 1000
    07/23/2020, 11, Cups, 800
    07/24/2020, 11, Cups, 1200
    07/27/2020, 11, Cups, 500
    07/23/2020, 15, Plates, 850
    07/24/2020, 15, Plates, 500
    07/25/2020, 15, Plates, 700
    7/27/2020, 15, Plates, 1000
    07/23/2020, 15, Cups, 200
    07/24/2020, 15, Cups, 150
    07/27/2020, 15, Cups, 500
];

//Get min &amp;amp; Max Date
temp:
LOAD min(Date) as MinDate,
     max(Date) as MaxDate
RESIDENT RAW;

LET varMinDate = Num(Peek('MinDate',-1,'temp'));
LET varMaxDate = Num(Peek('MaxDate',-1,'temp'));
drop table temp;

//Fill Date Gaps
tmp:
LOAD date($(varMinDate)+ rowno() -1) AS Date
AUTOGENERATE $(varMaxDate)-$(varMinDate)+1;

Join (tmp)
LOAD ID,
	 Type
Resident RAW;

Join (RAW)
LOAD DISTINCT *
Resident tmp;

DROP Table tmp;

//fill gaps with previous values
FINAL:
NoConcatenate
LOAD Date,
     ID,
     Type,
     If(ID = Peek(ID) and Type = Peek(Type) and IsNull(Value), Peek(Value), Value) as Value
Resident RAW
Order By ID, Type, Date ASC;

DROP Table RAW;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Jul 2020 13:19:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731771#M722372</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-07-29T13:19:50Z</dc:date>
    </item>
  </channel>
</rss>

