<?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 Re: 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/1731868#M721795</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;, thank you so much.&lt;/P&gt;&lt;P&gt;With a little change in the expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;PRE&gt;     If( IsNull(Value),Peek(Value),Value) as Value&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(ID = Peek(ID) and Type = Peek(Type) and IsNull(Value), Peek(Value), Value) as Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I got this working with my actual data. Thanks&amp;nbsp;&lt;A href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628" target="_blank" rel="noopener"&gt;@sunny_talwar&lt;/A&gt;&amp;nbsp;for the expression. Also,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/2752"&gt;@zhadrakas&lt;/a&gt;&amp;nbsp; thank you for all the help. Every bit helped and is highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jul 2020 18:50:05 GMT</pubDate>
    <dc:creator>qlikwiz123</dc:creator>
    <dc:date>2020-07-29T18:50:05Z</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/1730428#M721785</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have dates and values associated as shown below&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;07/23/2020 – 1000&lt;/P&gt;&lt;P&gt;07/24/2020 – 1200&lt;/P&gt;&lt;P&gt;07/27/2020 – 800&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;Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;07/23/2020 – 1000&lt;/P&gt;&lt;P&gt;07/24/2020 – 1200&lt;/P&gt;&lt;P&gt;07/25/2020 – 1200&lt;/P&gt;&lt;P&gt;7/26/2020&amp;nbsp; &amp;nbsp; - 1200&lt;/P&gt;&lt;P&gt;7/27/2020&amp;nbsp; &amp;nbsp;- 800&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:15:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1730428#M721785</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2024-11-16T00:15:59Z</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/1730524#M721786</link>
      <description>&lt;P&gt;this should do it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;RAW:
Load 1 as Dim, MakeDate(2020, 7, 23) as Date, 1000 as Value AutoGenerate(1);
Load 1 as Dim, MakeDate(2020, 7, 29) as Date, 1200 as Value AutoGenerate(1);
Load 1 as Dim, MakeDate(2020, 8, 27) as Date, 800 as Value AutoGenerate(1);

//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
join (RAW)
LOAD date($(varMinDate)+ rowno() -1) AS Date
AUTOGENERATE $(varMaxDate)-$(varMinDate)+1;

//fill gaps with previous values
FINAL:
NoConcatenate
Load Date,
     If( IsNull( Value ), Peek( Value ), Value ) as Value
Resident RAW
order by Date ASC;
drop table RAW;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jul 2020 07:00:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1730524#M721786</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-24T07:00:57Z</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/1730686#M721787</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/2752"&gt;@zhadrakas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my sample QVW, it is failing. Can you please tell me 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;</description>
      <pubDate>Fri, 24 Jul 2020 15:23:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1730686#M721787</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2020-07-24T15:23:24Z</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/1730923#M721788</link>
      <description>&lt;P&gt;change the last part of the script like this.&lt;/P&gt;&lt;P&gt;maybe you want to add ID or Type in order by statement if you want to change the logic.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FINAL:
NoConcatenate
Load Date,
     If( IsNull( Value ), Peek( Value ), Value ) as Value,
     If( IsNull( ID ), Peek( ID ), ID ) as ID,
     If( IsNull( Type ), Peek( Type ), Type ) as Type
Resident RAW
order by Date ASC;
drop table RAW;&lt;/LI-CODE&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 05:08:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1730923#M721788</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-27T05:08:23Z</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/1731078#M721789</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/2752"&gt;@zhadrakas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still does not work. Please look at the QVW attached.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:27:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731078#M721789</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2020-07-27T14:27:00Z</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/1731240#M721790</link>
      <description>&lt;P&gt;please explain in detail what is not working.&lt;/P&gt;&lt;P&gt;i've downloaded your qvw and everything works as expected. there is no gap in the data model.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 06:09:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731240#M721790</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-28T06:09:58Z</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/1731432#M721791</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="qlikwiz123_0-1595947663413.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38198i79C033A6DDED300A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="qlikwiz123_0-1595947663413.png" alt="qlikwiz123_0-1595947663413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="qlikwiz123_1-1595947695217.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38199i122C235E6EC33F2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="qlikwiz123_1-1595947695217.png" alt="qlikwiz123_1-1595947695217.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you look at these instances, the dates aren't populated for every ID for every Type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 14:48:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731432#M721791</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2020-07-28T14:48:38Z</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/1731584#M721792</link>
      <description>&lt;P&gt;yes thats different to the first approach.&lt;/P&gt;&lt;P&gt;can you please show me a sample with your desired output?&lt;/P&gt;&lt;P&gt;the problem with that is that if i change the logic to fill up all "Date-ID-Type-combinations, it will add more datasets than just the gaps of the dates that are not existing.&lt;/P&gt;&lt;P&gt;if there are more columns in future that are important for you, please add them right now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 06:23:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731584#M721792</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2020-07-29T06:23:50Z</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/1731798#M721793</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For every ID-Type-Date-Value row, I want all the dates to be generated and for the missing Value, it should pick up the last Value and repeat it until a new date with value is present.&lt;/P&gt;&lt;P&gt;Present:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="qlikwiz123_1-1596031130122.png" style="width: 270px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/38290iDAF5620FBE185C9C/image-dimensions/270x140?v=v2" width="270" height="140" role="button" title="qlikwiz123_1-1596031130122.png" alt="qlikwiz123_1-1596031130122.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Desired Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="0" width="256" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64" height="17"&gt;Date&lt;/TD&gt;&lt;TD width="64"&gt;ID&lt;/TD&gt;&lt;TD width="64"&gt;Type&lt;/TD&gt;&lt;TD width="64"&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;7/23/20202&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Cups&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;7/24/2020&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Cups&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;7/25/2020&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Cups&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;7/26/2020&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Cups&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;7/27/2020&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Cups&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, for other IDs and Type&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 14:02:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731798#M721793</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2020-07-29T14:02:12Z</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/1731832#M721794</link>
      <description>&lt;LI-CODE lang="javascript"&gt;RAW:
LOAD *, AutoNumberHash256(Date&amp;amp;ID&amp;amp;Type) as Key;
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;
LOAD FieldValue('Date',RecNo()) as Date
AutoGenerate FieldValueCount('Date');

LET varMinDate = Num(Peek('MinDate',-1,'temp'));
LET varMaxDate = Num(Peek('MaxDate',-1,'temp'));

drop table temp;

//Fill Date Gaps
NoConcatenate
Full:
LOAD date($(varMinDate)+ rowno() -1) AS Date
AUTOGENERATE $(varMaxDate)-$(varMinDate)+1;

Join(Full)
LOAD Distinct ID
Resident RAW;

Join(Full)
LOAD Distinct Type
Resident RAW;

Full_Key:
LOAD *,
    AutoNumberHash256(Date&amp;amp;ID&amp;amp;Type) as Key1
Resident Full;

DROP Table Full;

Concatenate(RAW)
LOAD *
Resident Full_Key
where not Exists(Key,Key1);

DROP Table Full_Key;

//fill gaps with previous values
FINAL:
NoConcatenate
Load Date,
      ID,
      Type,
     If( IsNull(Value),Peek(Value),Value) as Value
Resident RAW
order by ID,Type,Date;

drop table RAW;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see the attached&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 15:32:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731832#M721794</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-29T15:32:21Z</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/1731868#M721795</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp;, thank you so much.&lt;/P&gt;&lt;P&gt;With a little change in the expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;PRE&gt;     If( IsNull(Value),Peek(Value),Value) as Value&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(ID = Peek(ID) and Type = Peek(Type) and IsNull(Value), Peek(Value), Value) as Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I got this working with my actual data. Thanks&amp;nbsp;&lt;A href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628" target="_blank" rel="noopener"&gt;@sunny_talwar&lt;/A&gt;&amp;nbsp;for the expression. Also,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/2752"&gt;@zhadrakas&lt;/a&gt;&amp;nbsp; thank you for all the help. Every bit helped and is highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 18:50:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731868#M721795</guid>
      <dc:creator>qlikwiz123</dc:creator>
      <dc:date>2020-07-29T18:50:05Z</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/1731879#M721801</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/9788"&gt;@qlikwiz123&lt;/a&gt;&amp;nbsp; I don't think you need that expression as I have already sorted table on final load so expression i used should work. but anyways glad that it was helpful&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:34:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fill-missing-dates-and-use-old-value/m-p/1731879#M721801</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-29T19:34:31Z</dc:date>
    </item>
  </channel>
</rss>

