<?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: Counting New and Exited IDs Between Months in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483207#M101005</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Flag like this:&lt;/P&gt;
&lt;P&gt;Department Date ID ExistsInPrevMonth NotExistsInNextMonth&lt;BR /&gt;KOBI 01-01-2023 12345 0 0&lt;BR /&gt;KOBI 01-01-2023 12346 0 0&lt;BR /&gt;KOBI 01-01-2023 12347 0 0&lt;BR /&gt;KOBI 01-01-2023 12348 0 1&lt;BR /&gt;KOBI 01-01-2023 12349 0 1&lt;BR /&gt;KOBI 01-01-2023 12350 0 0&lt;BR /&gt;KOBI 01-02-2023 12345 1 1&lt;BR /&gt;KOBI 01-02-2023 12346 1 1&lt;BR /&gt;KOBI 01-02-2023 12347 1 1&lt;BR /&gt;KOBI 01-02-2023 12350 1 1&lt;BR /&gt;KOBI 01-02-2023 12351 0 1&lt;BR /&gt;KOBI 01-02-2023 12352 0 1&lt;BR /&gt;KOBI 01-02-2023 12354 0 1&lt;BR /&gt;KOBI 01-03-2023 12356 0 0&lt;BR /&gt;KOBI 01-03-2023 12357 0 0&lt;BR /&gt;KOBI 01-03-2023 12358 0 0&lt;BR /&gt;KOBI 01-03-2023 12359 0 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2024 11:13:48 GMT</pubDate>
    <dc:creator>adh79</dc:creator>
    <dc:date>2024-09-24T11:13:48Z</dc:date>
    <item>
      <title>Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2482999#M100977</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I'm need some help with counting IDs that have either joined or exited between months. Here's my input table i Qlik Sense load:&lt;/P&gt;
&lt;P&gt;OriginalData:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Department, Date, ID&lt;BR /&gt;KOBI, 01-01-2023, 12345&lt;BR /&gt;KOBI, 01-01-2023, 12346&lt;BR /&gt;KOBI, 01-01-2023, 12347&lt;BR /&gt;KOBI, 01-01-2023, 12348&lt;BR /&gt;KOBI, 01-01-2023, 12349&lt;BR /&gt;KOBI, 01-01-2023, 12350&lt;BR /&gt;KOBI, 01-02-2023, 12345&lt;BR /&gt;KOBI, 01-02-2023, 12346&lt;BR /&gt;KOBI, 01-02-2023, 12347&lt;BR /&gt;KOBI, 01-02-2023, 12350&lt;BR /&gt;KOBI, 01-02-2023, 12351&lt;BR /&gt;KOBI, 01-02-2023, 12352&lt;BR /&gt;KOBI, 01-02-2023, 12354&lt;BR /&gt;KOBI, 01-03-2023, 12356&lt;BR /&gt;KOBI, 01-03-2023, 12357&lt;BR /&gt;KOBI, 01-03-2023, 12358&lt;BR /&gt;KOBI, 01-03-2023, 12359&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;In this dataset, each row represents an ID for a department on a particular date (always the 1st of each month). My goal is to calculate two things for each month:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;STRONG&gt;Joined IDs:&lt;/STRONG&gt; IDs that exist in the current month but did not exist in the previous month.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Exited IDs:&lt;/STRONG&gt; IDs that exist in the current month but will not exist in the next month.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I've tried various approaches using &lt;CODE&gt;ApplyMap&lt;/CODE&gt; and &lt;CODE&gt;Exists&lt;/CODE&gt;, but I haven't been able to get consistent results.&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 11:25:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2482999#M100977</guid>
      <dc:creator>adh79</dc:creator>
      <dc:date>2024-09-23T11:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483192#M101001</link>
      <description>&lt;P&gt;Load your data sorting by the Id , Department, Date&lt;BR /&gt;&lt;BR /&gt;Make a if Previous (department) =&amp;nbsp;Department and&amp;nbsp;&amp;nbsp;Previous (Id ) =&amp;nbsp;ID&amp;nbsp; and&amp;nbsp;Previous (Date) &amp;lt;&amp;gt;&amp;nbsp;Date, 1, 0) as&amp;nbsp;&lt;STRONG&gt;Joined IDs&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;second case you might need to do a loop load , load the month, then the future month (if exist) and&amp;nbsp; left join by Id+ Department as key, if where is connection&amp;nbsp; that means exist in future month&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 10:30:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483192#M101001</guid>
      <dc:creator>TcnCunha_M</dc:creator>
      <dc:date>2024-09-24T10:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483201#M101003</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/76060"&gt;@adh79&lt;/a&gt;&amp;nbsp; How would you Flag Joined and Exited in your example data?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 10:56:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483201#M101003</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-24T10:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483207#M101005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Flag like this:&lt;/P&gt;
&lt;P&gt;Department Date ID ExistsInPrevMonth NotExistsInNextMonth&lt;BR /&gt;KOBI 01-01-2023 12345 0 0&lt;BR /&gt;KOBI 01-01-2023 12346 0 0&lt;BR /&gt;KOBI 01-01-2023 12347 0 0&lt;BR /&gt;KOBI 01-01-2023 12348 0 1&lt;BR /&gt;KOBI 01-01-2023 12349 0 1&lt;BR /&gt;KOBI 01-01-2023 12350 0 0&lt;BR /&gt;KOBI 01-02-2023 12345 1 1&lt;BR /&gt;KOBI 01-02-2023 12346 1 1&lt;BR /&gt;KOBI 01-02-2023 12347 1 1&lt;BR /&gt;KOBI 01-02-2023 12350 1 1&lt;BR /&gt;KOBI 01-02-2023 12351 0 1&lt;BR /&gt;KOBI 01-02-2023 12352 0 1&lt;BR /&gt;KOBI 01-02-2023 12354 0 1&lt;BR /&gt;KOBI 01-03-2023 12356 0 0&lt;BR /&gt;KOBI 01-03-2023 12357 0 0&lt;BR /&gt;KOBI 01-03-2023 12358 0 0&lt;BR /&gt;KOBI 01-03-2023 12359 0 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 11:13:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483207#M101005</guid>
      <dc:creator>adh79</dc:creator>
      <dc:date>2024-09-24T11:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483295#M101022</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/76060"&gt;@adh79&lt;/a&gt;&amp;nbsp; try below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;OriginalData:
LOAD *
INLINE [
Department, Date, ID
KOBI, 01-01-2023, 12345
KOBI, 01-01-2023, 12346
KOBI, 01-01-2023, 12347
KOBI, 01-01-2023, 12348
KOBI, 01-01-2023, 12349
KOBI, 01-01-2023, 12350
KOBI, 01-02-2023, 12345
KOBI, 01-02-2023, 12346
KOBI, 01-02-2023, 12347
KOBI, 01-02-2023, 12350
KOBI, 01-02-2023, 12351
KOBI, 01-02-2023, 12352
KOBI, 01-02-2023, 12354
KOBI, 01-03-2023, 12356
KOBI, 01-03-2023, 12357
KOBI, 01-03-2023, 12358
KOBI, 01-03-2023, 12359
];

Left Join(OriginalData)
Load max(FieldValue('Date',RecNo())) as max_date
AutoGenerate FieldValueCount('Date');

New:
Load *,
    if(ID&amp;lt;&amp;gt;Previous(ID),0,1) as ExistsInPrevMonth   
Resident OriginalData
Order by ID,Date;

Drop Table OriginalData;

Final:
Load *,    
     if(ID=Previous(ID) or Date = max_date,0,1) as NotExistsInNextMonth  
Resident New
Order by ID,Date desc;

Drop Tables New;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 14:58:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483295#M101022</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-24T14:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Counting New and Exited IDs Between Months</title>
      <link>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483377#M101037</link>
      <description>&lt;P&gt;A big thank you to everyone who helped with this solution. The approach using &lt;CODE&gt;Previous()&lt;/CODE&gt; and &lt;CODE&gt;max_date&lt;/CODE&gt; was exactly what I needed to compare IDs across months and handle large datasets efficiently. It works perfectly now!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 06:58:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Counting-New-and-Exited-IDs-Between-Months/m-p/2483377#M101037</guid>
      <dc:creator>adh79</dc:creator>
      <dc:date>2024-09-25T06:58:07Z</dc:date>
    </item>
  </channel>
</rss>

