<?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: Filter select first instance of in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017627#M84031</link>
    <description>&lt;P&gt;I think you have a pretty good grasp of things already, so maybe this could work and would be easy to understand as well, as you already understand basics of SQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lets assume you have a date fields which consists of date/time of visit of the patient.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Load&amp;nbsp;&lt;/P&gt;
&lt;P&gt;patientID,&amp;nbsp;&lt;SPAN&gt;gender, age, type of visit&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From Table;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Load&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;patientID,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;min(date) as visit_date&amp;nbsp; &amp;nbsp; &amp;nbsp;//if you want the first time the patient visits and max(date) if you want latest date.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Where Year&amp;gt;=2019 and year&amp;lt;=2021&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Age &amp;gt;=40 and age&amp;lt;=50;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Dec 2022 12:42:46 GMT</pubDate>
    <dc:creator>deepanshuSh</dc:creator>
    <dc:date>2022-12-17T12:42:46Z</dc:date>
    <item>
      <title>Filter select first instance of</title>
      <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017614#M84029</link>
      <description>&lt;P&gt;The concept is easy, but I'm struggling - I think I'm overlooking something basic and I need a little help.&lt;/P&gt;
&lt;P&gt;I have a small/medium data set (12k rows) - it's medically related (but no patient identifying info).&lt;BR /&gt;&lt;BR /&gt;To keep the concept simple, let's suppose my data is patient doctor visits (with patient ID, date of visit, gender, age, type of visit, etc).&lt;BR /&gt;&lt;BR /&gt;Suppose I want to see ALL patient visits between 2019 and 2021 for female patients between the ages of 40 and 55 (easy enough).&lt;BR /&gt;&lt;BR /&gt;NOW suppose I want that same data set above, but I only want to see the FIRST time each patient visited.&amp;nbsp; &amp;nbsp;&amp;lt;-- How the heck do I do that?&lt;BR /&gt;&lt;BR /&gt;From a SQL perspective this is pretty straight forward - (1) filter the data set to get the sub set, (2) Grab Patient ID and Date of visit, (3) group by patient ID&amp;nbsp; and determine Max(date of visit), (4) go back to the subset and filter by new criteria of patient/max(date of visit).&lt;BR /&gt;&lt;BR /&gt;But I can't seem to crack this in qlik.&amp;nbsp; I'm missing something.&amp;nbsp; Any help would be appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit for clarity:&lt;BR /&gt;&lt;BR /&gt;[This is what I need]&lt;BR /&gt;&lt;STRONG&gt;Return a data grid of all patients' first visits&lt;/STRONG&gt;&amp;nbsp;(by date) between Aug. 2017 and July 2020 where they received a flu shot, and were female, and were between the ages of 45 and 57 at the time of the appointment.&amp;nbsp; Where the user can, in real time switch between male/female, the date range, the age range, everything....&lt;BR /&gt;&lt;BR /&gt;(if there is a clever way of creating helper columns at design time, I'm all in.&amp;nbsp; But as I think about this, I believe this "first visit" must be determined at runtime because "first" changes with every filter reduction)&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 16:51:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017614#M84029</guid>
      <dc:creator>tdegen_qlik</dc:creator>
      <dc:date>2022-12-17T16:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filter select first instance of</title>
      <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017627#M84031</link>
      <description>&lt;P&gt;I think you have a pretty good grasp of things already, so maybe this could work and would be easy to understand as well, as you already understand basics of SQL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lets assume you have a date fields which consists of date/time of visit of the patient.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Load&amp;nbsp;&lt;/P&gt;
&lt;P&gt;patientID,&amp;nbsp;&lt;SPAN&gt;gender, age, type of visit&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From Table;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Load&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;patientID,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;min(date) as visit_date&amp;nbsp; &amp;nbsp; &amp;nbsp;//if you want the first time the patient visits and max(date) if you want latest date.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Where Year&amp;gt;=2019 and year&amp;lt;=2021&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Age &amp;gt;=40 and age&amp;lt;=50;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 12:42:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017627#M84031</guid>
      <dc:creator>deepanshuSh</dc:creator>
      <dc:date>2022-12-17T12:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Filter select first instance of</title>
      <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017651#M84034</link>
      <description>&lt;P&gt;I'm afraid that would only ever get the first visit &lt;U&gt;ever&lt;/U&gt; by the patient.&lt;BR /&gt;&lt;BR /&gt;I want the first visit date &lt;EM&gt;after&amp;nbsp;&lt;/EM&gt;all the other filters/reduction are applied.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Imagine you were a patient who visited your doctor two or three times each year (every year) since 2010.&lt;BR /&gt;&lt;BR /&gt;Can you answer: What is your first visit between the years 2011 and 2012?&amp;nbsp; What is your first visit between September of 2017 and May of 2020?&amp;nbsp; &amp;nbsp;What is your first visit where you received a flu shot?&lt;BR /&gt;&lt;BR /&gt;If I only had to do this with ONE patient I can do that with sorting and only taking the first row.&amp;nbsp; BUT I need to do this with a dataset of dozens/hundreds of patients.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[This is what I need]&lt;BR /&gt;&lt;STRONG&gt;Return a data grid of all patients' first visits&lt;/STRONG&gt;&amp;nbsp;(by date) between Aug. 2017 and July 2020 where they received a flu shot, and were female, and were between the ages of 45 and 57 at the time of the appointment.&amp;nbsp; Where the user can, in real time switch between male/female, the date range, the age range, everything....&lt;/P&gt;</description>
      <pubDate>Sat, 17 Dec 2022 16:49:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2017651#M84034</guid>
      <dc:creator>tdegen_qlik</dc:creator>
      <dc:date>2022-12-17T16:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filter select first instance of</title>
      <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2018135#M84071</link>
      <description>&lt;P&gt;Why not do it on the front end, using the set analysis and aggregation function (aggr) grouping on month/year as well as patient ID? It would be easier for you to test, but a little computation intensive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 16:30:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2018135#M84071</guid>
      <dc:creator>deepanshuSh</dc:creator>
      <dc:date>2022-12-19T16:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Filter select first instance of</title>
      <link>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2018153#M84074</link>
      <description>&lt;P&gt;That's kinda what I'm asking for help with.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"How do I do this on the front end?"&lt;/P&gt;
&lt;P&gt;You are suggesting set analysis and aggr function?&amp;nbsp; &amp;nbsp;I've used set analysis extensively for filtering.&amp;nbsp; But not for getting the "first instance of"&lt;/P&gt;
&lt;P&gt;How might that look?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 16:54:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Filter-select-first-instance-of/m-p/2018153#M84074</guid>
      <dc:creator>tdegen_qlik</dc:creator>
      <dc:date>2022-12-19T16:54:39Z</dc:date>
    </item>
  </channel>
</rss>

