<?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: How to get all continuous months between two dates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2457492#M98567</link>
    <description>&lt;P&gt;Hi, thank you for the response! I get the error 'mindate not found' when loading this script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2024 12:52:15 GMT</pubDate>
    <dc:creator>ndorciak</dc:creator>
    <dc:date>2024-05-29T12:52:15Z</dc:date>
    <item>
      <title>How to get all continuous months between two dates</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2455769#M98457</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on loading a data set looking at patient eligibility for a certain insurance. For this data set, I have a patient ID, start date of eligibility, and stop date of eligibility. See example of data below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-23 112935.png" style="width: 204px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166716i71FE22B82E8BDE91/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-23 112935.png" alt="Screenshot 2024-05-23 112935.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like to create a "Yes/No" field in the load script for each patient ID on whether or not they are eligible for the insurance for each month. For example, all the months between 3/1/2022 and 12/31/2022 would say "Yes" for eligibility for patient ID 4, but all the months between 12/31/2022 and 4/1/2023 would say "No" for eligibility for patient ID 4. We thought about using a "For Each" loop, but it seems inefficient given the size of our data set. What would be the best way to achieve this result?&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 15:45:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2455769#M98457</guid>
      <dc:creator>ndorciak</dc:creator>
      <dc:date>2024-05-23T15:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all continuous months between two dates</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2455793#M98459</link>
      <description>&lt;P&gt;Hi, You can achieve this by creating a master calendar and then joining it with your data. Here's how you can do it:&lt;/P&gt;
&lt;P&gt;// Load your data&lt;BR /&gt;LOAD &lt;BR /&gt;[Patient ID], &lt;BR /&gt;[Start Date], &lt;BR /&gt;[Stop Date]&lt;BR /&gt;FROM [YourDataSource];&lt;/P&gt;
&lt;P&gt;// Create a master calendar&lt;BR /&gt;TempCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;date(mindate + IterNo()) as TempDate&lt;BR /&gt;AUTOGENERATE 1 WHILE mindate + IterNo() &amp;lt;= maxdate;&lt;/P&gt;
&lt;P&gt;LET varMinDate = Num(Peek('mindate', 0, 'TempCalendar'));&lt;BR /&gt;LET varMaxDate = Num(Peek('maxdate', -1, 'TempCalendar'));&lt;/P&gt;
&lt;P&gt;DROP Table TempCalendar;&lt;/P&gt;
&lt;P&gt;MasterCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;$(varMinDate) + IterNo() - 1 As Num,&lt;BR /&gt;Date($(varMinDate) + IterNo() - 1) as TempDate&lt;BR /&gt;AutoGenerate $(varMaxDate) - $(varMinDate) + 1;&lt;/P&gt;
&lt;P&gt;// Join the master calendar with your data&lt;BR /&gt;LEFT JOIN (MasterCalendar)&lt;BR /&gt;LOAD &lt;BR /&gt;[Patient ID], &lt;BR /&gt;[Start Date] as TempDate, &lt;BR /&gt;'Yes' as Eligibility&lt;BR /&gt;RESIDENT YourData;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (MasterCalendar)&lt;BR /&gt;LOAD &lt;BR /&gt;[Patient ID], &lt;BR /&gt;[Stop Date] as TempDate, &lt;BR /&gt;'No' as Eligibility&lt;BR /&gt;RESIDENT YourData;&lt;/P&gt;
&lt;P&gt;This script will create a new field &lt;STRONG&gt;Eligibility&lt;/STRONG&gt; in your data that indicates whether a patient is eligible for each date. Please replace &lt;STRONG&gt;[YourDataSource]&lt;/STRONG&gt; with your actual data source.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if this helps! If it's still not working, could you please provide more details about the error or issue you're encountering? This will help me assist you better.&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 17:45:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2455793#M98459</guid>
      <dc:creator>Sayed_Mannan</dc:creator>
      <dc:date>2024-05-23T17:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all continuous months between two dates</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2457492#M98567</link>
      <description>&lt;P&gt;Hi, thank you for the response! I get the error 'mindate not found' when loading this script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 12:52:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2457492#M98567</guid>
      <dc:creator>ndorciak</dc:creator>
      <dc:date>2024-05-29T12:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get all continuous months between two dates</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2457592#M98578</link>
      <description>&lt;P&gt;I forgot to find mindate and maxdate, here is the updated script,&lt;/P&gt;
&lt;P&gt;// Load your data&lt;BR /&gt;YourData:&lt;BR /&gt;LOAD&lt;BR /&gt;[Patient ID],&lt;BR /&gt;[Start Date],&lt;BR /&gt;[Stop Date]&lt;BR /&gt;FROM [YourDataSource];&lt;/P&gt;
&lt;P&gt;// Calculate min and max dates&lt;BR /&gt;TempCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;min([Start Date]) as minDate,&lt;BR /&gt;max([Stop Date]) as maxDate&lt;BR /&gt;RESIDENT YourData;&lt;/P&gt;
&lt;P&gt;LET varMinDate = Num(Peek('minDate', 0, 'TempCalendar'));&lt;BR /&gt;LET varMaxDate = Num(Peek('maxDate', 0, 'TempCalendar'));&lt;/P&gt;
&lt;P&gt;DROP Table TempCalendar;&lt;/P&gt;
&lt;P&gt;// Create a master calendar&lt;BR /&gt;MasterCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;$(varMinDate) + IterNo() - 1 As Num,&lt;BR /&gt;Date($(varMinDate) + IterNo() - 1) as TempDate&lt;BR /&gt;AutoGenerate $(varMaxDate) - $(varMinDate) + 1;&lt;/P&gt;
&lt;P&gt;// Join the master calendar with your data&lt;BR /&gt;LEFT JOIN (MasterCalendar)&lt;BR /&gt;LOAD&lt;BR /&gt;[Patient ID],&lt;BR /&gt;[Start Date] as TempDate,&lt;BR /&gt;'Yes' as Eligibility&lt;BR /&gt;RESIDENT YourData;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (MasterCalendar)&lt;BR /&gt;LOAD&lt;BR /&gt;[Patient ID],&lt;BR /&gt;[Stop Date] as TempDate,&lt;BR /&gt;'No' as Eligibility&lt;BR /&gt;RESIDENT YourData;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 16:45:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-all-continuous-months-between-two-dates/m-p/2457592#M98578</guid>
      <dc:creator>Sayed_Mannan</dc:creator>
      <dc:date>2024-05-29T16:45:04Z</dc:date>
    </item>
  </channel>
</rss>

