<?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: Two set analysis conditions from one fact table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1826125#M67931</link>
    <description>&lt;P&gt;Thanks for the reply, Steve. I thought that the intersection of my two sets, using the * between them, would get me patients who meet both conditions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't put everything into one set because the fields [IsSameYear] and [YearDiff] would collide. They are in the As-Of Calendar.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 15:26:16 GMT</pubDate>
    <dc:creator>Lauri</dc:creator>
    <dc:date>2021-08-02T15:26:16Z</dc:date>
    <item>
      <title>Two set analysis conditions from one fact table</title>
      <link>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1824913#M67762</link>
      <description>&lt;P&gt;I'm trying to count the number of patients who meet two conditions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Age during the year was 18 to 85 &lt;STRONG&gt;AND&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Diagnosed with hypertension in the year or the prior year&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I set up an "as-of" table linked to my fact table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lauri_0-1627400888215.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59243i2B17048D8F9CAD9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lauri_0-1627400888215.png" alt="Lauri_0-1627400888215.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;[CC] contains values like 'Hypertension.' [AgeAtEvent] contains age values. The fact table looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lauri_1-1627401235770.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/59244i216F4E8427D18F85/image-size/large?v=v2&amp;amp;px=999" role="button" title="Lauri_1-1627401235770.png" alt="Lauri_1-1627401235770.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with the set analysis to count these patients. This includes patients even when the CC condition is not met:&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;PatientID=p({&amp;lt;IsSameYear={1}, AgeAtEvent={"&amp;gt;=18&amp;lt;=85"}&amp;gt;})&amp;gt;*&amp;lt;PatientID=p({&amp;lt;[CC]={'Hypertension'}, YearDiff={"&amp;lt;2"}&amp;gt;})&amp;gt;} Distinct PatientID)&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 15:55:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1824913#M67762</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2021-07-27T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Two set analysis conditions from one fact table</title>
      <link>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1824969#M67770</link>
      <description>&lt;P&gt;Are you missing the field in your P() ?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=Count({&amp;lt;PatientID=p({&amp;lt;IsSameYear={1}, AgeAtEvent={"&amp;gt;=18&amp;lt;=85"}&amp;gt;} &lt;FONT color="#339966"&gt;&lt;STRONG&gt;PatientID&lt;/STRONG&gt;&lt;/FONT&gt;)&amp;gt;*&amp;lt;PatientID=p({&amp;lt;[CC]={'Hypertension'}, YearDiff={"&amp;lt;2"}&amp;gt;} &lt;FONT color="#339966"&gt;&lt;STRONG&gt;PatientID)&lt;/STRONG&gt;&lt;/FONT&gt;&amp;gt;}&amp;nbsp;&amp;nbsp;Distinct PatientID)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But i don't think your calculation logically matches what you wrote.&amp;nbsp; Your first set doesn't include anything about CC, so first set will return PatientIDs between 18-85 and SameYear=1 (whatever this is).&amp;nbsp; The 2nd set will return all patient IDs who have CC = Hypertension, but doesn't include anythign about age.&amp;nbsp; So you will get patients who were 18-85 at some point in your data/filters and had hypertension at some age, but not necessarily the combination.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Why 2 sets for PatientID?&amp;nbsp; And not:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;=Count({&amp;lt;PatientID=p({&amp;lt;IsSameYear={1}, AgeAtEvent={"&amp;gt;=18&amp;lt;=85"}, [CC]={'Hypertension'}, YearDiff={"&amp;lt;2"}&amp;gt;} &lt;FONT color="#339966"&gt;&lt;STRONG&gt;PatientID&lt;/STRONG&gt;&lt;/FONT&gt;) &amp;gt;}&amp;nbsp;&amp;nbsp;Distinct PatientID)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:04:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1824969#M67770</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-07-27T20:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Two set analysis conditions from one fact table</title>
      <link>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1826125#M67931</link>
      <description>&lt;P&gt;Thanks for the reply, Steve. I thought that the intersection of my two sets, using the * between them, would get me patients who meet both conditions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't put everything into one set because the fields [IsSameYear] and [YearDiff] would collide. They are in the As-Of Calendar.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 15:26:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Two-set-analysis-conditions-from-one-fact-table/m-p/1826125#M67931</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2021-08-02T15:26:16Z</dc:date>
    </item>
  </channel>
</rss>

