<?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 create rows for missing dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/create-rows-for-missing-dates/m-p/23250#M3877</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with rows for each procedure performed on a patient during inpatient hospital visit (Account Number). I need to add rows for days that the patient did not have a procedure so that I end up with at least one row for each day, starting with the patient's Admit Date and finishing with the patients last Procedure Date. Here's an example of one patient's procedures. The yellow rows are what I need to add.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a calendar that fills in the missing dates but I can't figure out how to get the missing dates on one row with the Account Number.&lt;IMG alt="MissingProcedureDates.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/191922_MissingProcedureDates.PNG" style="height: 306px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jan 2018 20:16:36 GMT</pubDate>
    <dc:creator>Margaret</dc:creator>
    <dc:date>2018-01-30T20:16:36Z</dc:date>
    <item>
      <title>create rows for missing dates</title>
      <link>https://community.qlik.com/t5/QlikView/create-rows-for-missing-dates/m-p/23250#M3877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with rows for each procedure performed on a patient during inpatient hospital visit (Account Number). I need to add rows for days that the patient did not have a procedure so that I end up with at least one row for each day, starting with the patient's Admit Date and finishing with the patients last Procedure Date. Here's an example of one patient's procedures. The yellow rows are what I need to add.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a calendar that fills in the missing dates but I can't figure out how to get the missing dates on one row with the Account Number.&lt;IMG alt="MissingProcedureDates.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/191922_MissingProcedureDates.PNG" style="height: 306px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jan 2018 20:16:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/create-rows-for-missing-dates/m-p/23250#M3877</guid>
      <dc:creator>Margaret</dc:creator>
      <dc:date>2018-01-30T20:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: create rows for missing dates</title>
      <link>https://community.qlik.com/t5/QlikView/create-rows-for-missing-dates/m-p/23251#M3878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can generate the rows in your procedure table in the load script by using WHILE in the LOAD statement to iterate and generate all dates between the Admit Date and Procedure Date with a script similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15173501448727428 jive_text_macro" jivemacro_uid="_15173501448727428" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;DATA0:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; *,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; [Procedure Date] AS PD, // Helper field so the original real Procedure Date can always be referenced&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; [Procedure Name] AS PN&amp;nbsp; // Helper field so the original real Procedure Name can always be referenced&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;INLINE [&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Admit Date,Account,Procedure Date,Procedure Name&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2018-01-26,A,2018-01-28,ABC #1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2018-01-26,A,2018-01-29,ABC #2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2018-01-26,A,2018-01-31,ABC #3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2018-01-26,A,2018-02-06,ABC #4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2018-01-01,B,2018-01-05,DEF #1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;PROCEDURE:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; [Admit Date],&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Account,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Date(If( Peek('Account')&amp;lt;&amp;gt;Account, [Admit Date]-1, Peek('Procedure Date'))+1,'YYYY-MM-DD')&amp;nbsp;&amp;nbsp;&amp;nbsp; AS [Procedure Date],&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; If(&amp;nbsp; If( Peek('Account')&amp;lt;&amp;gt;Account, [Admit Date], Peek('Procedure Date'))+1 &amp;lt;&amp;gt; PD , '' , PN) AS [Procedure Name],&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; PD,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; PN&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;RESIDENT&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp; DATA0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;WHILE &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp; If( Peek('Account')&amp;lt;&amp;gt;Account, [Admit Date], Peek('Procedure Date')+1) &amp;lt;= PD&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;DROP TABLE DATA0;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;DROP FIELDS PD,PN; // Drop helper fields&lt;/SPAN&gt;&lt;/P&gt;



&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jan 2018 22:09:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/create-rows-for-missing-dates/m-p/23251#M3878</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-01-30T22:09:11Z</dc:date>
    </item>
  </channel>
</rss>

